This will show you how get some character length form ending of php string.
Use
substr() with a negative number for the 2nd argument.<?php
$mystring = "abcdefgh123";
//Get last 5 characters
$string = substr($mystring, -5);
//Output will like 'gh123'
//Get last 10 characters from string
$string = substr($mystring, -10);
//Output will like 'bcdefgh123'
?>
0 comments:
Post a Comment