david212 Posted April 29, 2010 Share Posted April 29, 2010 Hello. I have one question. As i know the ++ means increment. ($x=5/$x++/$x=6) But in this code $x = 25; $y = ($x++); echo $y; the value rest at 25, my question is : if $x=25 , so $x++ won't be 26? What happens in this case? Could someone explain please? Thank you Quote Link to comment https://forums.phpfreaks.com/topic/200149-n00b-question/ Share on other sites More sharing options...
Alex Posted April 29, 2010 Share Posted April 29, 2010 $var++ will return the current value of $var then increment it. Use ++$var, which increments and returns the current value, to get the result you expect. Quote Link to comment https://forums.phpfreaks.com/topic/200149-n00b-question/#findComment-1050432 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.