note 102341 modified in language.operators.precedence by danbrown

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
Be very careful with the precedence. See this code:

<?php
$a = 1;
$b = null;
$c = isset($a) && isset($b);
$d = ( isset($a) and isset($b) );
$e = isset($a) and isset($b);
var_dump($a, $b, $c, $d, $e);
?>

Result:

int(1)
NULL
bool(false)
bool(false)
bool(true) <==

--was--
Be very careful with the precedence. See this code:

$a = 1;
$b = null;
$c = isset($a) && isset($b);
$d = ( isset($a) and isset($b) );
$e = isset($a) and isset($b);
var_dump($a, $b, $c, $d, $e);

Result:

int(1)
NULL
bool(false)
bool(false)
bool(true) <==

http://php.net/manual/en/language.operators.precedence.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.