Reply to Re: [PHP] Str to Int

Your name:

Reply:


Posted by "Ron Eggler (Paykiosks)" on 01/21/06 02:02

Am Freitag, den 20.01.2006, 18:28 -0500 schrieb comex:
> > if ($cardID=''||is_int($cardID))
>
> Two problems with that statement:
> First of all, this statement _sets_ cardID to '', and then (I think)
> returns a false value since '' doesn't evaluate to true. You probably
> wanted ==.

hOOOOOOOOOOOOOOps that's right, shit, haven't seen that......hm okay, it
works fine now, thanks again!

> Second of all, now that $cardID is '', it certainly isn't an int. It
> isn't an int, and it wouldn't be an int if you fixed that statement
> because is_int only tests if it is, actually, an integer.
> $HTTP_GET_VARS['cardID'] could be '123', but it can't be 123 and so
> that will be false. From the PHP manual:
>
> Note: To test if a variable is a number or a numeric string (such
> as form input, which is always a string), you must use is_numeric().
>

[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

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