Precedence isn't very well explained in php see here:
https://www.php.net/manual/en/language.operators.precedence.php
this isn't clear for example:
$x = (float)'100'/100;
will this first cast '100' to float, then make the division, or divide first, then make the cast?
My Answer:
In PHP, the cast operators have a higher precedence than arithmetic operators. So in the expression `$x = (float)'100'/100;`, the string '100' will first be cast to a float and then divided by 100. The result will be assigned to the variable `$x`.
Rate this post
5 of 5 based on 3145 votesComments