#33616 [NEW]: The Answer to Life, the Universe and Everything = 41?

From: Date: Fri, 08 Jul 2005 13:35:27 +0000
Subject: #33616 [NEW]: The Answer to Life, the Universe and Everything = 41?
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-81587@lists.php.net to get a copy of this message
From: panos at com2go dot com Operating system: Linux PHP version: 4.3.11 PHP Bug Type: *Math Functions Bug description: The Answer to Life, the Universe and Everything = 41? Description: ------------ While to trying to make a simple one line script that will display the answer to life, the universe, and everything I noticed that the answer comes up wrong if the equiation is concatenated with text. The text is not displayed instead 1 is subtracted from any mathimatical equation that is concatenated with any text. It seems that PHP is not differentiating between text and integer and assigning the text a value of -1. You may consider this a 'feature' as text is assigned a value of -1 or FALSE and . is percived as +. However for that to be true "echo 1 . 1" should return "2" not "11" Reproduce code: --------------- print "What do you get if you multiply SIX by NINE: ". 1 + 5 * 8 + 1; Expected result: ---------------- What do you get if you multiply SIX be NINE: 42 Actual result: -------------- 41 -- Edit bug report at http://bugs.php.net/?id=33616&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33616&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33616&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33616&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=33616&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=33616&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33616&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33616&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33616&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33616&r=support Expected behavior: http://bugs.php.net/fix.php?id=33616&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33616&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33616&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=33616&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33616&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=33616&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33616&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33616&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33616&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33616&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33616&r=mysqlcfg

« previous php.bugs (#81587) next »