int connection_status ( void ) returns 0 if the connection is live; : connection_status « Utility Function « PHP






int connection_status ( void ) returns 0 if the connection is live;

 
1 if the connection is aborted; 2 if the connection has been aborted; and 3 if the connection has been aborted and subsequently timed out.


<?
    function say_goodbye( ) {
            if (connection_status( ) =  = CONNECTION_TIMEOUT) {
                    print "Script timeout!\n";
            } else {
                    print "Goodbye!\n";
            }
    }

    register_shutdown_function("say_goodbye");
    set_time_limit(1);
    print "Sleeping...\n";
    sleep(2);
    print "Done!\n";
?>
  
  








Related examples in the same category