search for in the  
<register_shutdown_functionunregister_tick_function>
Last updated: Thu, 19 May 2005

register_tick_function

(PHP 4 >= 4.0.3, PHP 5)

register_tick_function --  Register a function for execution on each tick

Description

void register_tick_function ( callback function [, mixed arg [, mixed ...]] )

Registers the function named by func to be executed when a tick is called. Also, you may pass an array consisting of an object and a method as the func.

Example 1. register_tick_function() example

<?php
// using a function as the callback
register_tick_function('my_function', true);

// using an object->method
$object = new my_class();
register_tick_function(array(&$object, 'my_method'), true);
?>

See also declare() and unregister_tick_function().



User Contributed Notes
register_tick_function
Michael Bailey (jinxidoru at byu dot net)
07-Jun-2004 03:16
Here's a nice function if you want to check how often your functions are getting called to make sure there aren't any useless files being included.  Just place the first script at the top of the beginning of your script (possibly using auto_prepend_file) and the second script at the end of your script (possibly using auto_append_file).

Script #1:
<?
function &watch_functions_tick($do_tick=true) {
   static
$funcs = array();
   static
$last_func;
  
   if (
$do_tick) {
      
$trace = debug_backtrace();
      
$func = $trace[1]['function'];
       if (
$trace[1]['class']) $func = $trace[1]['class'].$trace[1]['type'].$func;

       if (
$func != $last_func && $func !== 'watch_functions_tick' && $func != 'unknown' && $func) {
          
$funcs[$func]++;
          
$last_func = $func;
       } elseif (!
$func || $func = 'unknown') {
          
$last_func = '';
       }
      
$funcs['__TICK_COUNT__']++;
   } else {
       return
$funcs;
   }
}
declare (
ticks=1);
?>

Script #2:
<?
print_r
(watch_functions_tick(false));
?>

-- Michael Bailey (http://www.jinxidoru.com)
microcamers_NOSPAM at hotmail dot com
27-Feb-2004 10:31
If your script will be used on Windows sytems running Apache, its best to stay away from this function... and for portability purposes, try and use a different function.

In most cases it will crash apache continually until the page is stopped from loading.

<register_shutdown_functionunregister_tick_function>
 Last updated: Thu, 19 May 2005
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: The Server Pages
Last updated: Thu May 19 17:35:34 2005 CDT