RE: [PHP] Strip Numbers
| From: | Martin Towell | Date: | Wed, 30 Jul 2003 06:57:58 +0000 |
| Subject: | RE: [PHP] Strip Numbers | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-157490@lists.php.net to get a copy of this message | ||
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:joe@harmanmedia.com]
Sent: Wednesday, 30 July 2003 4:52 PM
To: php-general@lists.php.net
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