|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10162 different behaviour of && and and operator
Submitted: 2001-04-04 11:59 UTC Modified: 2001-04-04 12:04 UTC
From: gerald dot kallas at web dot de Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 4.0.4 OS: Windows 2000 Professional
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: gerald dot kallas at web dot de
New email:
PHP Version: OS:


 [2001-04-04 11:59 UTC] gerald dot kallas at web dot de
in the case shown below both operators generate different values, once TRUE twice FALSE

source code

function isValid_and($a)
  $valid = true;
  $b = 1;
  $valid = $valid and (strlen($a) >= $b);
  return $valid;

function isValid_and_($a)
  $valid = true;
  $b = 1;
  $valid = $valid && (strlen($a) >= $b);
  return $valid;

$a = "";

if (isValid_and($a))
  echo "and - true<br/>";
  echo "and - false<br/>";

if (isValid_and_($a))
  echo "&& - true<br/>";
  echo "&& - false<br/>";


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-04 12:04 UTC]
Please check this manual page:

Not a bug.


PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Sep 28 08:01:25 2023 UTC