I was learning php declare statement.I sow the following php code:
<?php
declare(ticks=1);
// A function called on each tick event
function tick_handler()
{
echo "<br>tick_handler() called ";
}
register_tick_function('tick_handler');
$a = 1;
if ($a > 0) {
$a += 2;
print($a);
}
?>
The output:
tick_handler() called
tick_handler() called
tick_handler() called 3
tick_handler() called
I can't understand why "tick_handler() called"
is printing 4 times and why " tick_handler() called 3"
appears at 3rd print.please help me with simple explanation.thanks