RE: [PHP] Finding numerical values in a string
| From: | Dana dot Reed at clinicaldatacare dot com | Date: | Thu, 31 Aug 2000 12:50:33 +0000 |
| Subject: | RE: [PHP] Finding numerical values in a string | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-14559@lists.php.net to get a copy of this message | ||
There's probably a more eloquent way to do this, but IF you know the length of the part before
the number you could use substr to return the rest.
So, if all $foo values begin with "notavail" you could use:
if ( $Pid == "notavail".substr($foo,8) ) {
..
}
med vänlig hälsning
/Dana
-----Original Message-----
From: jblythe@bold.net.au [SMTP:jblythe@bold.net.au]
Sent: Thursday, August 31, 2000 12:27 PM
To: php-general@lists.php.net
Subject: [PHP] Finding numerical values in a string
Hey,
I was wondering if anyone knew how to detect a numerical value at the end of a string lets say I got
all these product id's which are unique, some are blank but still need a value so I have used:
notavail1, notavail2, notavail3 etc.....
Now in a if statement I need to find any of these like so..
if ( $Pid == "notavail<num value>" ) {
..
}
In Mysql you have the LIKE clause, but I was wondering how I would detect if the string is like:
notavail(num), I hope this makes sense to you.
Please make sure you reply to this message privately as well as the list as I'm at home and not
subsribed from here.
Any help always appreciated.
Joseph Blythe