trimm integer

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
User avatar
nhan
Forum Commoner
Posts: 95
Joined: Sun Feb 27, 2005 8:26 pm
Contact:

trimm integer

Post by nhan »

i have here a 13 digit number 0012132267272, is there a way i can get the first 5 or six digits of that said number and then compare it to another 5 digit number, any tutorial or site would be a great help...

thanks!

nhan
Syranide
Forum Contributor
Posts: 281
Joined: Fri May 20, 2005 3:16 pm
Location: Sweden

Post by Syranide »

substr
User avatar
nhan
Forum Commoner
Posts: 95
Joined: Sun Feb 27, 2005 8:26 pm
Contact:

Post by nhan »

thanks, but in comparing the said digit in a heirachy manner for example:

number: 0012132267272

i would compare it to:

001213
00121
001

what function should i use....

thanks!
Syranide
Forum Contributor
Posts: 281
Joined: Fri May 20, 2005 3:16 pm
Location: Sweden

Post by Syranide »

your own function that is, everything it not premade.
this is something you have to write on your own. (should be fairly easy)
User avatar
nhan
Forum Commoner
Posts: 95
Joined: Sun Feb 27, 2005 8:26 pm
Contact:

Post by nhan »

ah ok thanks! im not really asking for the exact code.. only the idea...
hehehehe... thanks so much!

actually im trying to make a rating system for toll free and local access numbers..

so the calls would be not just 5 or 6 lines but hundreds of thousands of lines.. so i really need to make the comparison the fastest way possible...

if and case statements would not be applicable.. since there would be numerous prefixes for comparison... hehehehe...

thanks!
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

I would suggest looking up regular expressions....

More information here...preg_match.
User avatar
nhan
Forum Commoner
Posts: 95
Joined: Sun Feb 27, 2005 8:26 pm
Contact:

solved

Post by nhan »

Thanks so much! thats what i need! :D
Post Reply