[PHP] Strip Numbers

2003-07-30 Thread Joe Harman
Hey could someone help me out here
 
I need to strip numbers from a passed variable
 
ex. 3899007
 
all the numbers will have 990 (so that is the 4th, 5th  sixth
numbers... from the right...) I want to keep everything to the left of
the two 9s... is there an easy way to do that
 
Joe Harman

http://www.HarmanMedia.com

This `telephone' has too many shortcomings to be seriously considered as
a means of communication. The device is inherently of no value to us. -
Western Union internal memo, 1876 
 


RE: [PHP] Strip Numbers

2003-07-30 Thread Martin Towell
You could use two substr()s or an ereg_replace()

$result = substr($str, 0, 2) . substr($str, 5);
or
$result = ereg_replace(([0-9][0-9])990([0-9][0-9]), \\1\\2,
$str);

Both are not tested, but should work

Martin


-Original Message-
From: Joe Harman [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 30 July 2003 4:52 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Strip Numbers


Hey could someone help me out here
 
I need to strip numbers from a passed variable
 
ex. 3899007
 
all the numbers will have 990 (so that is the 4th, 5th  sixth
numbers... from the right...) I want to keep everything to the left of
the two 9s... is there an easy way to do that
 
Joe Harman

http://www.HarmanMedia.com

This `telephone' has too many shortcomings to be seriously considered as
a means of communication. The device is inherently of no value to us. -
Western Union internal memo, 1876 
 
__ Information from NOD32 1.468 (20030725) __

This message was checked by NOD32 for Exchange e-mail monitor.
http://www.nod32.com




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Strip Numbers

2003-07-30 Thread Jeff Harris
On Jul 30, 2003, Joe Harman claimed that:

|Hey could someone help me out here
|
|I need to strip numbers from a passed variable
|
|ex. 3899007
|
|all the numbers will have 990 (so that is the 4th, 5th  sixth
|numbers... from the right...) I want to keep everything to the left of
|the two 9s... is there an easy way to do that
|
|Joe Harman
|
|http://www.HarmanMedia.com
|
Since a problem should be stated in its basic and simplest terms, it
appears that you want to simply divide the
number by 1 and take the integer portion:
$number=floor($passed/1);

Jeff
-- 
Registered Linux user #304026.
lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import
Key fingerprint = 52FC 20BD 025A 8C13 5FC6  68C6 9CF9 46C2 B089 0FED
Responses to this message should conform to RFC 1855.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php