Write a PHP script to get the last three characters of a string

substr():-

The substr() function returns a part of a string.


code:-

<?php
$str = 'hello';
echo substr($str, -3)."\n";
?>

output:-
llo

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post