Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

substr last 3 characters

<?php

$string = "testing string 123";

echo substr($string,-3); //this will give last 3 characters of the above string
// output "123"
echo substr($string,-5); //this will give last 5 characters of the above string
// output "g 123"
echo substr($string,5); //this will give first 5 characters of the above string
// output "testi"

?>
 
PREVIOUS NEXT
Tagged: #substr #characters
ADD COMMENT
Topic
Name
1+5 =