+ 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. */

23rd Jun 2017, 9:21 PM
ismail Banouigu
ismail Banouigu - avatar
8 Answers
+ 2
(a++ )== (a = a +1)
24th Jun 2017, 11:14 AM
jaivar
jaivar - avatar
+ 2
welcome so are you doing well in php right now ?
27th Jun 2017, 7:32 PM
Said BAHAOUARY
Said BAHAOUARY - avatar
+ 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.
23rd Jun 2017, 9:49 PM
AL Emran
AL Emran - avatar
+ 1
but what about ++z
23rd Jun 2017, 10:31 PM
ismail Banouigu
ismail Banouigu - avatar
+ 1
++z is oposit of --z. It called pre increment.
24th Jun 2017, 5:07 AM
AL Emran
AL Emran - avatar
+ 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
24th Jun 2017, 5:23 PM
Said BAHAOUARY
Said BAHAOUARY - avatar
+ 1
thank my friend @Said
24th Jun 2017, 5:48 PM
ismail Banouigu
ismail Banouigu - avatar
+ 1
yes thank you my brother's @said now when i challenge anyone i got 5/5 on php
27th Jun 2017, 9:44 PM
ismail Banouigu
ismail Banouigu - avatar