$count = 5;
function get_count()
{
static $count = 0;
return $count++;
}
echo $count;
++$count;
echo get_count();
echo get_count();
I guessed it outputs 5 0 1 and it's right,but I need a better explanation?
question from:https://stackoverflow.com/questions/1642333/php-static-variables