How to get the last 7 characters from a string in PHP

1 Answer

0 votes
$s = "php programming";

$last_7_ch = substr($s, -7);
 
echo $last_7_ch;
 
 
 
 
/*
run:
 
ramming
 
*/

 



answered Jun 19, 2021 by avibootz
...