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 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. Link to comment https://forums.phpfreaks.com/topic/200149-n00b-question/#findComment-1050432 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.