php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26464 ternary with multiple expression is boolean operator sensitive
Submitted: 2003-11-29 11:13 UTC Modified: 2003-11-29 11:22 UTC
From: php at jmvware dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.3.2 OS: SunOS/Linux/Windows
Private report: No CVE-ID: None
 [2003-11-29 11:13 UTC] 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-29 11:22 UTC] derick@php.net
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 01:01:28 2024 UTC