php里的declare用法
2020-12-13 14:55
标签:class blog code cti 代码 时间 function tick_handler () register_tick_function ( ‘tick_handler‘ ); declare( ticks = 1 ){ if ( $a > 0 ) { 这里首先定义了两个函数,然后注册到系统,随后通过declare定义一个ticks,步长为1,作用是在declare作用域中的代码每执行ticks次步长,就执行一次注册的方法,方法顺与注册的顺序一致。 所以上面的执行结果是: tick_handler() called 这个方法可以测试执行代码的处理时间。 php里的declare用法,搜素材,soscw.com php里的declare用法 标签:class blog code cti 代码 时间 原文地址:http://www.cnblogs.com/kudosharry/p/3795356.html
{
echo "tick_handler() called
" ;
}
function tick_handler1 ()
{
echo "tick_handler1() called
" ;
}
register_tick_function ( ‘tick_handler1‘ );
$a = 1 ;
$a += 2 ;
print( $a );
}
}
exit;
tick_handler1() called
tick_handler() called
tick_handler1() called
3tick_handler() called
tick_handler1() called
tick_handler() called
tick_handler1() called
tick_handler() called
tick_handler1() called
tick_handler() called
tick_handler1() called
下一篇:.net 附加W3wp进程