Reply to Re: [PHP] Declaring vars as INT ?

Your name:

Reply:


Posted by Jordan Miller on 10/21/05 23:08

Hello,

you could treat your variable as a string, and use the is_numeric()
function (but this will include floats, too). To answer your question
precisely and accurately, you may have to do regex matching since you
are out of the bounds of int.

However, why, *exactly*, are you trying to confirm that your string
is an integer? It seems to me kind of cumbersome and unnecessary. If
you provide more explicit information on what you are trying to do,
your overarching goal for the script, including what are your inputs
and intended outputs, along with some real code, we can probably find
a solution that will do what you want without mucking about like
this. Just my two cents.

Jordan




On Oct 21, 2005, at 2:39 PM, Chris Knipe wrote:

> Hi,
>
> Uhm... Let's take the below quickly:
>
> Function DoSomething($Blah) {
> $Blah = (int) $Blah;
> return $Blah
> }
>
> $Blah, cannot be larger than 2147483647, and sometimes, I get negative
> integers back from the above function.
>
> This is with PHP 4.4.0 on FreeBSD 5.4-STABLE. Can anyone else perhaps
> confirm this, and if it is indeed true, is this a bug, or a limitation
> somewhere on PHP? Any other ways to confirm that *large* numbers, are
> indeed integers? I'm working with numbers in the form of yyyymmddsss
> (20051025001 for today for example)
>
> Thanks,
> Chris.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>

[Back to original 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

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