You are here: Re: finding whole numbers « All PHP « IT news, forums, messages
Re: finding whole numbers

Posted by J.O. Aho on 10/03/06 16:18

Steve wrote:
> also, you have to assume the markup of the number based on the language of
> the system. a lot of countries use commas not only to denote whole number
> portions but the decimal as well. 1,200,00 akin to 1,200.00
>
>
> ".:[ ikciu ]:." <no@mail.com> wrote in message
> news:efu08o$l0s$1@news.dialog.net.pl...
> | Zebrawszy mysli fang <fang27@excite.com> wyklepal:
> | > Anyone have a suggestion as to what function I can use in php to find
> | > if a number is a whole number, and does not have a decimal?
> |
> |
> | if(!empty(eregi_replace('([0-9]+)','',$yourNumber)){
> | echo 'not a number';
> | }
> |
> | doesn' works for float values :) but you can simply change it :)

is_numeric($yourvalue);

Works for both integers and floats.
If you know that the variable is not a string, then you can use

is_int($yourvalue);

to check if a value is integer or not.


//Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация