PHP Part of a String
To get a part of a string in PHP, use
the substr function.
It cuts out and returns a substring from a string.
The original string itself is not changed.
The first parameter of the function is the string, the second is the number of the character to start cutting from (numbering starts from zero), and the third - is the number of characters to cut out:
See the example:
<?php
echo substr('abcdef', 1, 3);
?>
Code execution result:
'bcd'