note 66812 modified in control-structures.declare by danbrown

From: Date: Sat, 19 Jul 2008 23:30:18 +0000
Subject: note 66812 modified in control-structures.declare by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-141793@lists.php.net to get a copy of this message
The scope of the declare() call if used without a block is a little unpredictable, in my experience. It appears that if placed in a method or function, it may not apply to the calls that ensue, like the following: <?php function a() { declare(ticks=2); b(); } function b() { // The declare may not apply here, sometimes. } ?> So, if all of a sudden the signals are getting ignored, check this. At the risk of losing the ability to make a mathematical science out of placing a number of activities at varying durations of ticks like many people have chosen to do, I've found it simple to just put this at the top of the code, and just make it global. --was-- The scope of the declare() call if used without a block is a little unpredictable, in my experience. It appears that if placed in a method or function, it may not apply to the calls that ensue, like the following: function a() { declare(ticks=2); b(); } function b() { // The declare may not apply here, sometimes. } So, if all of a sudden the signals are getting ignored, check this. At the risk of losing the ability to make a mathematical science out of placing a number of activities at varying durations of ticks like many people have chosen to do, I've found it simple to just put this at the top of the code, and just make it global. http://php.net/manual/en/control-structures.declare.php

« previous php.notes (#141793) next »