You are here: Re: Php... 01 greater than 1 ??? « PHP Programming Language « IT news, forums, messages
Re: Php... 01 greater than 1 ???

Posted by Joe Scylla on 05/29/07 12:30

wbrowse wrote:
> Thanks,
>
> For the first issue, I came to understand from a similar post I made
> earlier that the reason why 01 is greater than 1 is because of :
>
> $nombre = $_POST['nombre']
>
> the memory address is the one that is being tested and 01 is greater
> than 1 because 01 is 2 characters long... is it the explanation?

well, php dont support type definitions. That means variables will get
evaluated based on the operation. I had similar problems with a switch
statement comparing a value with leading zero with a number. For me it
looked like the value with leading zero "01" got interpreted as string
and compared with the number 1 the result is false.

That should help you out:
$nombre = (int) $_POST['nombre'];

More about this topic:
http://php.net/manual/en/language.types.type-juggling.php

 

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

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