PHP 使用声明 ?什么是蜱虫?
我对 PHP 函数 declare
有点困惑。
到底什么是单蜱?我认为一个勾号等于一行代码?
但如果我使用:
function myfunc() {
print "Tick";
}
register_tick_function("myfunc");
declare(ticks=1) {
echo 'foo!bar';
}
脚本打印:
“Tick”2 次?
I am a little bit confused by the PHP function declare
.
What exactly is a single tick? I thought a tick equals one line of code?
But if I use:
function myfunc() {
print "Tick";
}
register_tick_function("myfunc");
declare(ticks=1) {
echo 'foo!bar';
}
The script prints:
"Tick" 2 Times??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
每行都会有一个勾号;以及每个块 {}
尝试一下:
没有阻塞,没有额外的勾选。
更多无关的块=更多的蜱虫。
PS:顺便说一下,刻度线是一种非常奇特的功能,它们只在少数极其罕见的情况下才有用。它们不等同于线程或任何东西。如果对您来说,蜱虫是问题的解决方案,那么您应该在另一个问题中发布您的问题,因为它可能不是正确的解决方案。
You get a tick for each line ; and each block {}
Try that:
No block, no extra tick.
More extraneous blocks = more ticks.
PS: by the way, ticks are quite the exotic feature and they're only useful in a few extremely rare situations. They are not equivalent to threading or anything. If, for you, ticks are the solution to a problem then you should post about your problem in another question because it's probably not the right solution to it.
关于蜱虫是什么,您是在正确的轨道上。
https://web.archive.org/web/20100801093511/http://www.tuxradar.com/practicalphp/4/21/0" archive.org/web/20100801093511/http://www.tuxradar.com/practicalphp/4/21/0
You are on the right track as to what a tick is.
https://web.archive.org/web/20100801093511/http://www.tuxradar.com/practicalphp/4/21/0