From:             [EMAIL PROTECTED]
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



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to