php的declare,php 中的declare
生活随笔
收集整理的這篇文章主要介紹了
php的declare,php 中的declare
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
測試代碼:
function profile()
{
global $tmp;
printf("Now tmp is %d.\n",$tmp);
}
register_tick_function("profile");
declare(ticks=3) {
$tmp = 1;
$tmp = 2;
$tmp = 3;
$tmp = 4;
$tmp = 5;
$tmp = 6;
$tmp = 7;
$tmp = 8;
$tmp = 9;
$tmp = 10;
$tmp = 11;
//unregister_tick_function("profile");
}
?>結(jié)果:
Now tmp is 3. Now tmp is 6. Now tmp is 9. Now tmp is 11.
分析:
1.register_tick_function 是用來 定義 處理tick事件的函數(shù)
2.ticks=N?每執(zhí)行 N 條低級語句就會發(fā)生的事件
3 ?.declare{} 括號內(nèi)的代碼即被測的代碼
注:這里不進一步研究“低級語句”概念
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎總結(jié)
以上是生活随笔為你收集整理的php的declare,php 中的declare的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java语言_java语言学习
- 下一篇: php task todolist,To