tick question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
global_erp_solution
Forum Commoner
Posts: 25
Joined: Sun Jul 08, 2012 6:47 am

tick question

Post by global_erp_solution »

I was playing with the sample code:

Code: Select all

declare(ticks=1);

// A function called on each tick event
function tick_handler()
{
    echo "tick \n";
}

register_tick_function('tick_handler');

$a = 1;

if ($a > 0) {
    $a += 2;
    print($a);
}
in the explanation, I expect the output to be tick tick 3 tick tick, but I got 3 ticks 3 and 3 ticks and no newline. Can anybody explain this behavior? where does the extra tick come from and where's the newline?
Post Reply