0

In/Decrement operators

<?php $x = 11; echo --$x; // The output is 10 echo $x--; // The output is 10 echo $x; // Why this is veriable output is 9 ?> I did not understand why $x out put is 9 plese clearly exappane it why decrese and with show your exampele Waiting for replay.. bye...

22nd Sep 2016, 6:49 AM
vinay
vinay - avatar
2 ответов
+ 1
$x-- it first prints its value then decrement occurs and stores the decremented value in memory --$x it decrements first and stores the decremented value in memory and then prints the value of x
23rd Sep 2016, 7:08 PM
SANDEEP P
0
because $x-- first print it's value than minus 1
22nd Sep 2016, 11:05 AM
Zames Roh
Zames Roh - avatar