ID:               26821
 User updated by:  ivo at benetech dot org
 Reported By:      ivo at benetech dot org
 Status:           Bogus
 Bug Type:         Documentation problem
 Operating System: Linux / RH 7.3
 PHP Version:      4.3.4
 New Comment:

> If someone asks you if A+B > 4 is, you wouldn't know what to
calculate...

I sincerely hope this would hold:

http://www.php.net/manual/en/language.operators.php#language.operators.precedence

....otherwise theres bigger problems.

If a statement such as 

"some arbitrary string" < 0

is not to be trusted then the documentation should be updated to
reflect this. Currently it explains strong comparisons with '===', weak
with '==' but it does not mention < or >, ony obliquely and it
obviously does not.

(http://www.php.net/manual/en/types.comparisons.php)

p.s. I am working with a site that manipulates strings everywhere. most
functions return < 0 on error or the processed string if all goes well.
just finished updting it to return ints always & use references for
strings.

still think it's an outright bug or at least a documentation problem
due to all the 'weak' type comparison references & examples everywhere.


Previous Comments:
------------------------------------------------------------------------

[2004-01-09 11:04:29] [EMAIL PROTECTED]

Who wants to evaluate "NANC" < 0??? It _absolutely_ makes no sense. If
someone asks you if A+B > 4 is, you wouldn't know what to calculate...

FYI I've tried ivo's script. Under PHP 4.3.3 it produces "should
happen...but doesnt" and under 4.3.0 it's "should not happen...but
does". 



------------------------------------------------------------------------

[2004-01-08 22:35:09] skissane at ics dot mq dot edu dot au

Vrana: your comment makes no sense. If "NANC" is converted to 0, then 0
< 0 would be FALSE, not true.

Compare these expressions:
"NANC" < 0    result TRUE
"NANC" < "0"  result FALSE
0 < 0         result FALSE

So it seems it is neither converting "NANC" to an integer 0, nor 0 to a
string "0". What actually is going on? The documentation should clarify
this.

------------------------------------------------------------------------

[2004-01-07 13:20:58] ivo at benetech dot org

It also print 0 as expected.

if( (int) "NANC" < 0)

also evaluates as expected.

------------------------------------------------------------------------

[2004-01-07 05:53:18] [EMAIL PROTECTED]

"NANC" is converted to 0 for comparison. It works for me as expected.
What is printed by the code <?php echo intval("NANC"); ?> on your
system?

------------------------------------------------------------------------

[2004-01-06 18:08:12] ivo at benetech dot org

Documentation needs to be more explicit about php being strongly
typed.

http://www.php.net/manual/en/language.types.type-juggling.php

or

http://www.php.net/manual/en/language.types.string.php#language.types.string.conversion

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/26821

-- 
Edit this bug report at http://bugs.php.net/?id=26821&edit=1

Reply via email to