Trimming a String in PHP
To trim a string in PHP, use
the substr function.
It extracts and returns a substring from a string.
The original string itself is not modified. The numbering
of string characters starts from zero. See the
example:
<?php
$arr = substr('abcdef', 1, 3);
echo $arr;
?>
Code execution result:
'bcd'