I accept your reasons for doing so.
But actually this behaviour makes the "==" comparision to a "maybe".
"Maybe they are equal." Documentation of this working will be helping not
much. The users of PHP have to understand the working of "==" at the lowest
I suggest, that you check your convert to a number. If the result is MAXINT,
MININT or NaN, it would be better not converting the operands and making a
In this case you havn't to make an extra documentation on this behaviour and
this operation will work like users expect.
Am Freitag, 9. Februar 2001 20:31 schrieb Zak Greant:
> How is this? I modified what Zeev said a wee bit:
> == is a 'loose' comparison operator .
> In most cases, this is more convenient - the operator does the right thing
> without needing any coaxing. In some cases, things will happen that are
> confusing - particularly when comparing values that have leading zeros (0)
> or when comparing very long numbers that are inside a string.
> The basic rule to follow is this:
> Character-by-character comparison is performed only if both arguments are
> strings and at least one of the strings does not look like a number .
> Another way to state this rule is:
> - If at least one of the arguments is not a string, a numeric comparison is
> - If both arguments are strings, but both of them look like numbers, a
> numeric comparison is made.
> - If both arguments are strings (and at least one of them doesn't look like
> a number), a string comparison is made.
>  If you need to perform an exact comparison between two values, take a
> look at the 'strict' comparison operator (===) and the strcmp() function.
>  See the manual section on types and strings to learn what rules PHP
> follows for recognising numbers within strings.
> (Thanks to Zeev for clarifying this issue.)
G+J BerlinOnline GmbH Tel. : +49-(0)30-2327-5210
im Pressehaus am Alexanderplatz Fax: +49-(0)30-2327-5596
Karl-Liebknecht-Straße 29 E-Mail: [EMAIL PROTECTED]
D-10178 Berlin URL: http://www.BerlinOnline.de
BerlinOnline ist ein Service von Berliner Zeitung, TIP BerlinMagazin,
Berliner Kurier und Berliner Abendblatt.
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]