#26464 [Opn->Bgs]: ternary with multiple expression is boolean operator sensitive

From: Date: Sat, 29 Nov 2003 16:22:09 +0000
Subject: #26464 [Opn->Bgs]: ternary with multiple expression is boolean operator sensitive
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-51341@lists.php.net to get a copy of this message
ID: 26464 Updated by: derick@php.net Reported By: php at jmvware dot com -Status: Open +Status: Bogus Bug Type: Unknown/Other Function Operating System: SunOS/Linux/Windows PHP Version: 4.3.2 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php RTFM: http://docs.php.net/operators Previous Comments: ------------------------------------------------------------------------ [2003-11-29 11:13:47] php at jmvware dot com Description: ------------ If the expression portion of the ternary operator is a mutliple comparison expression the && operator does NOT return the same results as the AND operator. Reproduce code: --------------- This works as expected: $a=5; $b=($a>1 && $a<10 ? 'yes' : 'no'); echo "$b<BR>"; // returns 'yes' Note, using AND in place of && $a=5; $b=($a>1 AND $a<10 ? 'yes' : 'no'); echo "$b<BR>"; // returns 1 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26464&edit=1

« previous php.bugs (#51341) next »