Jake McHenry <mailto:[EMAIL PROTECTED]>
    on Wednesday, March 17, 2004 9:01 AM said:

> Does this always work? In my timesheet app, I have to do $counter =
> $counter + 1, because for some reason the $counter++; doesn't work.
> It just doesn't work, no incrementation of the variable. Is there
> something in php.ini that can prohibit this from working?

$var++ is a post incrementer meaning the value is updated at the next
command*.
++$var is a pre increment meaning the value is updated immediately.

is it possible you are expecting the results of ++$var?

try this and see what happens:

<?php

  $var = 2;

  echo $var++ . "<br>";

  echo ++$var . "<br>";

?>

also, i don't know of anything in the php.ini that would turn this short
hand off. seems unlikely that there is.


chris.

* i'm not exactly sure how the compiler determines when to post
increment, but i think i'm correct.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to