Add "1" and overwrite the previous value I have a cookie where a number is stored.
When I want to add "1" to the stored number and then overwrite it, I use this php code:

$temp = $_COOKIE['mycookie']++;
$_COOKIE['mycookie']=$temp;


Is it the best way to do that?
I think what you may be looking for is found on this page.


  This is happening because of the ++ being used as a post-increment
  instead of a pre-increment. Essentially what is happening is you're
  saying, "set $cookie to the value of $_COOKIE['count'], and then
  increment $_COOKIE['count'].


Go for ++$_COOKIE['mycookie']; instead and let us know how that works out.