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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php at jmvware dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed Sep 17 08:00:02 2025 UTC