why don't you use this??

http://it.php.net/manual/it/function.is-integer.php

Cesar Cordovez ha scritto:

This is getting weird by the minute. I changed the script:

if ($number != $value) {
    echo "Bad";
} else {
     echo "Good";  // echoes Good!!!!!!
}

to:
($number != $value)
($number !== $value)
($number === $value)

and I get the Good stuff...


At this point, I think I have to change the procedure. This is not good. Any sugestions on how to now if the user types an integer number in a field?


Cesar

Curt Zirzow wrote:

* Thus wrote Cesar Cordovez ([EMAIL PROTECTED]):

Curt:

My fault! You are right, but thats not what I want. $value comes from a form filled by a user. I want $value to be an integer. Not a float. So if the user types "12.3" the system has to send an error msg.



Yeah, after reading merek's response I realized I missed what exactly your problem is.


Therefore the procedure.

By-the-way, Im using PHP 4.3.3 (on windows XP profesional. Don't say a thing!!! I rather work on my mac!) =)



Thats odd, I come up with a 'Bad' echo also. The only thing I can think of is there is some sort of implicit casting happening to the $value within the comparison. But it does seem very strange that XP would cast but *nix doesn't

In that case test the condition reversed:
  if ($value != $number)


I'm at a loss as to why it doesn't work on your system.



Curt



-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to