Page 1 of 1

trimm integer

Posted: Tue Jun 28, 2005 4:18 am
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

Posted: Tue Jun 28, 2005 4:19 am
by Syranide
substr

Posted: Tue Jun 28, 2005 4:30 am
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!

Posted: Tue Jun 28, 2005 4:31 am
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)

Posted: Tue Jun 28, 2005 5:31 am
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!

Posted: Tue Jun 28, 2005 9:04 am
by CoderGoblin
I would suggest looking up regular expressions....

More information here...preg_match.

solved

Posted: Wed Jun 29, 2005 4:16 am
by nhan
Thanks so much! thats what i need! :D