The Last Character of a String in PHP
To get the last character
of a string, you can use the substr function.
See the example:
<?php
$last = substr('abcdef', -1)
echo $last;
?>
Code execution result:
'f'
To get the last character
of a string, you can use the substr function.
See the example:
<?php
$last = substr('abcdef', -1)
echo $last;
?>
Code execution result:
'f'