From: [EMAIL PROTECTED] Operating system: PHP version: 4.3.9 PHP Bug Type: Documentation problem Bug description: "Comparing strings" manual page
Description: ------------ After studying some string issues I think we need one more page in manual about strings comparison with a link to/from strcmp. Few confusing examples from user-notes on http://www.php.net/manual/en/language.types.string.php And I haven't found any clear answer about is === operator equal to strcmp() if two arguments are strings with numbers in the beginning? Many coders use "==" instead of "strcmp" and there should be warning somewhere in manual about possible problems that could arise due to such misuse. See also: http://bugs.php.net/bug.php?id=28200 Reproduce code: --------------- <?php $x1 = '111111111111111111'; $x2 = '111111111111111112'; echo ($x1 == $x2) ? "true\n" : "false\n"; //true ?> <? $hello='hi there'; echo($hello?'true':'false'); //true echo($hello==0?'true':'false'); //true!!!!! echo($hello===0?'true':'false'); //false ?> -- Edit bug report at http://bugs.php.net/?id=30399&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30399&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30399&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30399&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30399&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30399&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30399&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30399&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30399&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30399&r=support Expected behavior: http://bugs.php.net/fix.php?id=30399&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30399&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30399&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30399&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30399&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30399&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30399&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30399&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30399&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30399&r=mysqlcfg