note 29085 added to control-structures.declare
| From: | daniel at swn dot php dot net | Date: | Sat, 01 Feb 2003 17:56:13 +0000 |
| Subject: | note 29085 added to control-structures.declare | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-43258@lists.php.net to get a copy of this message | ||
<?php
ob_end_clean();
ob_implicit_flush(1);
function a() {
for($i=0;$i<=100000;$i++) { }
echo "function a() ";
}
function b() {
for($i=0;$i<=100000;$i++) { }
echo "function b() ";
}
register_tick_function ("a");
register_tick_function ("b");
declare (ticks=4)
{
while(true)
{
sleep(1);
echo "\n<br><b>".time()."</b><br>\n";;
}
}
?>
You will see that a() and b() are slowing down this process. They are in fact not executed every
second as expected. So this function is not a real alternative for multithreading using some slow
functions..there is no difference to this way: while (true) { a(); b(); sleep(1); }
--
http://www.php.net/manual/en/control-structures.declare.php
http://master.php.net/manage/user-notes.php?action=edit+29085
http://master.php.net/manage/user-notes.php?action=delete+29085
http://master.php.net/manage/user-notes.php?action=reject+29085