note 102341 modified in language.operators.precedence by danbrown
| From: | danbrown@php.net | Date: | Wed, 09 Feb 2011 20:25:17 +0000 |
| Subject: | note 102341 modified in language.operators.precedence by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-176819@lists.php.net to get a copy of this message | ||
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