<?php
declare(ticks=1);
function tick_handler()
{
print($GLOBALS['a']);
}
register_tick_function('tick_handler');
function test()
{
$a = 1;//This not print
$a = 2;//This not print
$a = 3;//This not print
$a = 4;//This not print
}
test();
$a = 1;//This print
$a = 2;//This print
$a = 3;//This print
$a = 4;//This print
?>
How print //This not print ,but without global $a ?
And without
function test()
{
$GLOBALS['a'] = 1;//This not print
$GLOBALS['a'] = 2;//This not print
$GLOBALS['a'] = 3;//This not print
$GLOBALS['a'] = 4;//This not print
}
I am not 100% sure what you are trying to do but
sounds like you-are-doing-it-wrong.
If you need to debug your application and/or need to see which functions and methods got called in what order and with what parameters, then use a proper debugger:
See https://stackoverflow.com/questions/1494288/good-free-php-debugger
You do not want to debug your production site. If you need to add more features or apply changes, do so on your development server first. Make sure it works, then deploy the changes to your production site. So either put XDebug on your local machine or into a VM or anything like that. Or get a new hoster for your development environment. In any case, put it where development and debugging wont disrupt production.