代码如下:
<?php $count = 5; function get_count(){ static $count = 0; return $count++; } echo $count; //5 ++$count; echo get_count(); //0 echo get_count(); //1 echo $count; //6
关于静态变量的说法可以参看C++的:static静态变量的理解
原文:http://www.cnblogs.com/gengyi/p/6523315.html