note 17728 added to language.operators.execution
| From: | justin at php2 dot chek dot com | Date: | Fri, 21 Dec 2001 05:52:55 +0000 |
| Subject: | note 17728 added to language.operators.execution | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-23732@lists.php.net to get a copy of this message | ||
What they're saying is that when you've got an expression which uses more than one
operator (i.e. the plus sign, minus sign, etc), then you look up the table to find out which ones
get priority. It's probably useful to be thought of as "Operator Importance" or
"Operator Priority".
For example, lets say you have the following expression :
$foo = 10 + 2 * 8.
$foo here equals 26, coz it gets calculated like this :
a) PHP notices it has to choose from either doing the 10+2 bit first, or the 2*8 bit first. It
doesn't do it from left to right as some people assume.
b) PHP looks up the table, and * has a higher priority than +, so it does the 2*8 bit first, and
gets 16. Now the expression looks like this :
$foo = 10 + (2 * 8)
$foo = 10 + 16
c) PHP finishes evaluating the expression, and stuffs the result into $foo
$foo = 16.
Hope that helps.
--
http://www.php.net/manual/en/language.operators.execution.php
http://master.php.net/manage/user-notes.php?action=edit+17728
http://master.php.net/manage/user-notes.php?action=delete+17728
http://master.php.net/manage/user-notes.php?action=reject+17728