note 122357 deleted from language.operators.comparison by cmb

From: Date: Tue, 05 Nov 2019 14:45:08 +0000
Subject: note 122357 deleted from language.operators.comparison by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-212938@lists.php.net to get a copy of this message
Note Submitter: ahmad dot mayahi at gmai dot com ---- (and) and (&&) have a slightly different behavior when it comes to comparison. (&&) and (=) have higher precedence than (and), in the following code: <?php $res = true and false; var_dump($res); //Returns: true ?> But why? It's because (=) has a higher precedence than (and): <?php ($res = true) and false; var_dump($rest); //Returns: true ?> But not for: <?php $bool = true && false; var_dump($bool); //Returns false ?> Please note that (or) act the same as (and).

« previous php.notes (#212938) next »