Number Trim?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
varma457
Forum Newbie
Posts: 23
Joined: Sat Jul 11, 2009 2:43 pm

Number Trim?

Post 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"
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Number Trim?

Post 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.
Post Reply