Re: Converting to integer
| From: | Matthew Weier O'Phinney | Date: | Tue, 16 Nov 2004 13:08:17 +0000 |
| Subject: | Re: Converting to integer | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-202131@lists.php.net to get a copy of this message | ||
* Octavian Rasnita <orasnita@fcc.ro>:
> I get some values from a MySQL table and some of them are in the format
> 1000.0, 234.0, etc.
>
> I want those values converted as 1000, 234, and so on, but the other string
> values need to remain the same.
>
> I have tried using the function is_numeric to test which of the values
> returned from MySQL are numbers, but none of them appear to be a number, so
> I cannot convert them.
Use intval($value) to get the integer value.
--
Matthew Weier O'Phinney | mailto:matthew@garden.org
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org