RE: [PHP-DB] Converting values from text to numerical
| From: | Adam Royle | Date: | Sat, 22 Jun 2002 02:33:17 +0000 |
| Subject: | RE: [PHP-DB] Converting values from text to numerical | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-19988@lists.php.net to get a copy of this message | ||
Hi Matt,
I think this might be the answer to your problem. It basically checks if the string is an integer. I generally love the PHP automatic type conversion, but sometimes it can trick ya.... :)
if (intval($val) == $val){
// integer stuff
} else {
// string stuff
}
Adam
Hi Russ, thanks for the reply ... if that will evaluate whether a (in this case) a text string is an integer or not, then its exactly what I need! :) if it doesnt work, I will post a more detailed example to the list and see what we can come up with! :)