Page 1 of 1

Number Trim?

Posted: Mon Jul 13, 2009 5:05 pm
by varma457
Say I have a phone number as a variable $number = "7345551234". Is there a function I can used to strip off the first 5 numbers so that I am left with only the last 5 in the variable? $number = "51234"

Re: Number Trim?

Posted: Mon Jul 13, 2009 5:07 pm
by requinix
Yay thread #55000!

Code: Select all

echo substr("7345551234", -5); // last five
echo substr("7345551234", 5); // starting at the fifth character
// 51234
Those substrs are also links.