PHP 4.0 Bug #10162 Updated: different behaviour of && and and operator
| From: | sniper@php.net | Date: | Wed, 04 Apr 2001 16:04:52 +0000 |
| Subject: | PHP 4.0 Bug #10162 Updated: different behaviour of && and and operator | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-50860@lists.php.net to get a copy of this message | ||
ID: 10162
Updated by: sniper
Reported By: gerald.kallas@web.de
Old-Status: Open
Status: Closed
Bug Type: Unknown/Other Function
Assigned To:
Comments:
Please check this manual page:
http://www.php.net/manual/en/language.operators.precedence.php
Not a bug.
--Jani
Previous Comments:
---------------------------------------------------------------------------
[2001-04-04 11:59:37] gerald.kallas@web.de
in the case shown below both operators generate different values, once TRUE twice FALSE
source code
<?php
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/>";
else
echo "and - false<br/>";
if (isValid_and_($a))
echo "&& - true<br/>";
else
echo "&& - false<br/>";
?>
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=10162&edit=2