register_tick_function
register_tick_function used to execute a function with each PHP operation. We must supply the name of a function and then execute a block of code inside a declare statement that sets the ticks value. Optionally, we may supply any number of additional arguments, which PHP passes to the callback function.
This function offers a way to profile code. we can log the time on the microsecond clock to test how long each operation takes to execute. unregister_tick_function used to unregister a tick function.
Example:
<?php
function ticks_func() {
print “ticks_function <br>”;
}
register_tick_function(”ticks_func”);
declare(ticks=4) {
for($i = 0; $i < 10; ++$i) {
print “Test<br>”;
}
}
?>
Output:
Test
Test
ticks_function
Test
Test
ticks_function
Test
Test
ticks_function
Test
Test
ticks_function
Test
Test
ticks_function
