+ 6
Question on php
$f=5; echo $f*$f++; Gives the output as 30, shouldn't it be 25 considering post increment is taking place?
3 Respostas
+ 4
like all programming language, there are rule of Operator Precedence:
http://php.net/manual/en/language.operators.precedence.php
so in this case, the first value load into memory is $f++ (equal 5) after this $f increment to 6, then the seconde operation is *. so since we have 5 in the memory, and $f = 6 so the output is 30.
+ 4
hey Hello
see the statements written is executed first before the echo prints its value by increasing By 1 so the increment is hidden but occurs as the statement is repeated unknowingly once for execution When it stays 5 and once for print when it gets covereted to 6 so it's in the whole 5*6=30
I hope u got it
+ 3
//This will solve your problem, happy coding :)
https://www.sololearn.com/learn/PHP/1826/