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]
|