Wednesday 15 January 2014

PHP post- increment/descrement operator precedence -


In the documentation it is said that ++ and - Operators have a very high priority but as I know, ++ $ x and $ x ++ are not equal, besides, $ x ++ < / Code> should have a minimum priority, because it has been computed after all:

  $ x = 1; Var_dump (1 and $ x--); // and operator is one of the last operators in the table, it will be executed before the shortage of the post   

So, the post-inchargement / decryption operators in this table should be below?

Yes, if operators are placed before the variable, the variable changes before any other order of operation is.

  $ a = 4; $ X = ++ $ a + 6; Will result in $ X = 11 and $ a = 5 $ x = $ a ++ + 6; $ X = 10 and $ a = 5 will result in   

When operators come in, it takes over all other operators. You can also find simple explanations on the following sites:



No comments:

Post a Comment