文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>php funciton 中的static

php funciton 中的static

时间:2011-01-05  来源:Enoch

<?php
function t(){
    static $a= 0;
    ++ $a;
   var_dump($a);
}
$i = 3;
while ($i--){
    t();
}
结果 1 ,2,3
见手册 $a is initialized only in first call of function and every time the t() function is called it will print the value of $a and increment it.

static的变量初始化只执行一次
相关阅读 更多 +
排行榜 更多 +
驾驶重型卡车模拟器

驾驶重型卡车模拟器

体育竞技 下载
计划大师

计划大师

游戏工具 下载
曼城足球学院

曼城足球学院

体育竞技 下载