note 119197 deleted from language.operators.precedence by cmb

From: Date: Thu, 07 Jul 2016 18:41:45 +0000
Subject: note 119197 deleted from language.operators.precedence by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-205921@lists.php.net to get a copy of this message
Note Submitter: Bilal Mustafa ---- Another way to sort out the problem mentioned by "nicoolasens at gmail dot com" and "Antistone" is: <?php $x = 4; echo "x minus one equals " . $x-1 . ", or so I hope"; ?> will print "-1, or so I hope" Solution: We can wrap the methematical part in "()" and let the parser tell to solve it first in other words here we can get the benefit of higher precedence of "()" So if we rewrite the example as: <?php $x = 4; echo "x minus one equals " . ($x-1) . ", or so I hope"; ?> The answer will be according to our expectation which is: "x minus one equals 3, or so I hope"

« previous php.notes (#205921) next »