+ 10
Post - decrement in php.
Can anyone explain to me why the answer is 20? $foo = 5; echo $foo * $foo--; // 20
3 Respostas
+ 1
its like
5 multiply by (5-1) //minus 1 to foo=5 bcz of the decrement -- then it will be 5 x 4.
+ 1
Apparently, the result varies between PHP versions according to the accepted answer in this thread.
https://www.sololearn.com/Discuss/2055656/?ref=app
https://code.sololearn.com/wKNpHCyYyQd2/?ref=app
0
Echo $foo(5) * $foo--( $foo is 5 bt there is -- so it will 4) (5*4)= 20