diff --git a/language/control-structures/declare.xml b/language/control-structures/declare.xml index 0b8a083504..dbd3927a3c 100644 --- a/language/control-structures/declare.xml +++ b/language/control-structures/declare.xml @@ -1,5 +1,5 @@ - + <literal>declare</literal> @@ -69,20 +69,18 @@ declare(ticks=1); Ticks - - - As of PHP 5.3.0 ticks are deprecated and will be removed - in PHP 6.0.0. - - A tick is an event that occurs for every - N low-level statements executed + N low-level tickable statements executed by the parser within the declare block. The value for N is specified using ticks=N within the declare blocks's directive section. + + Not all statements are tickable. Typically, condition + expressions and argument expressions are not tickable. + The event(s) that occur on each tick are specified using the register_tick_function. See the example @@ -91,56 +89,59 @@ declare(ticks=1); - Profile a section of PHP code + Tick usage example ;"; - } +if ($a > 0) { + $a += 2; + print($a); } -// Display the data stored in the profiler -print_r(profile(TRUE)); ?> ]]> - The example profiles the PHP code within the 'declare' - block, recording the time at which every second low-level - statement in the block was executed. This information can - then be used to find the slow areas within particular - segments of code. This process can be performed using other - methods: using ticks is more convenient and easier to - implement. + The above example is the equivalent of the following: + + + 0) { + $a += 2; + tick_handler(); + print($a); + tick_handler(); +} +tick_handler(); + +?> +]]> + + - - Ticks are well suited for debugging, implementing simple - multitasking, background I/O and many other tasks. - See also register_tick_function and unregister_tick_function. diff --git a/reference/funchand/functions/register-tick-function.xml b/reference/funchand/functions/register-tick-function.xml index 875641e1b9..5931e35342 100644 --- a/reference/funchand/functions/register-tick-function.xml +++ b/reference/funchand/functions/register-tick-function.xml @@ -1,5 +1,5 @@ - + register_tick_function @@ -94,8 +94,7 @@ register_tick_function(array(&$object, 'my_method'), true); 5.3.0 - Ticks are now deprecated and register_tick_function - now throws an E_DEPRECATED notice. + Ticks are now supported on threaded web server modules. @@ -109,8 +108,7 @@ register_tick_function(array(&$object, 'my_method'), true); register_tick_function should not be used with - threaded web server modules. Ticks are not working in ZTS mode and may - crash your web server. + threaded web server modules with PHP 5.2 or lower.