PHP 4.0 Bug #10162: different behaviour of && and and operator

From: Date: Wed, 04 Apr 2001 15:59:37 +0000
Subject: PHP 4.0 Bug #10162: different behaviour of && and and operator
Groups: php.dev 
Request: Send a blank email to php-dev+get-50856@lists.php.net to get a copy of this message
From: gerald.kallas@web.de Operating system: Windows 2000 Professional PHP version: 4.0.4 PHP Bug Type: Unknown/Other Function Bug description: different behaviour of && and and operator 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/>"; ?> -- Edit Bug report at: http://bugs.php.net/?id=10162&edit=1

« previous php.dev (#50856) next »