+ 1
My friends can you help me please?
so i have a small problem ... what is difference between x++ and --x when i do many challenges but... just i have this problems I'm waiting you're answers.. /*i know the difference but when i go to practice i have an error. */
8 Respostas
+ 2
(a++ )== (a = a +1)
+ 2
welcome so are you doing well in php right now ?
+ 1
x++ is called post-increment -- it increments the variable after it returns the original value as the value of the expression
--x is called pre-decrement. It Decrease the value first.
+ 1
but what about ++z
+ 1
++z is oposit of --z. It called pre increment.
+ 1
heyy @ismail look it's very easy
post increment
$x = 1;
echo $x++ // out out 1 but $x next time will equal 2
we increment the value but we don't assigne it
another example
$x = 1;
$y = $x++; // here $y take just 1 and $x will be 2 if we call it
but here
$x = 1;
echo ++$x // $x will equal 2
*******
$x = 1;
$y = ++$x; // $x will be 2 and $y will be also equal 2
+ 1
thank my friend @Said
+ 1
yes thank you my brother's @said
now when i challenge anyone i got 5/5 on php