register_tick_function

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

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.