int timeout_add(int timeout, callback callback [, mixed user_data1, ... ]);

Registers a function to be called periodically. The function will be called repeatedly after interval milliseconds until it returns false (or nothing) at which point the timeout is destroyed and will not be called again.

So to keep the timeout alive, your callback function needs to return true;

Example 13. Using Gtk::timeout_add() to create a simple clock

//Simple clock using Gtk::timeout_add()

//At first, we need a label displaying the time
$lbl = new GtkLabel('Clock');
//Now, call function "onTimeout" every 1 second
// (1 second == 1000 milliseconds)
//Also pass $lbl as parameter so we can
// change it in the function without using
// global variables (bad!)
Gtk::timeout_add(1000, 'onTimeout', $lbl);

//our callback function has one parameter,
// the one we defined in Gtk::timeout_add()
function onTimeout($lbl)
    //do the things we want to do

    //at the end, return "true" if the timeout shall
    // be executed again. If you don't return anything
    // or return false, the timeout is stopped.
    return true;

//standard stuff
$wnd = new GtkWindow();
$wnd->connect_simple('destroy', array('gtk', 'main_quit'));

The integer returned by this method can be used by timeout_remove() to destroy the timeout independent of the return value of the callback.