note 101483 modified in control-structures.declare by danbrown

From: Date: Sun, 19 Dec 2010 19:32:14 +0000
Subject: note 101483 modified in control-structures.declare by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-175071@lists.php.net to get a copy of this message
check loaded server connection <?php $connection = false; function checkConnection( $connectionWaitingTime = 3 ) { // check connection & time global $time,$connection; if( ($t = (time() - $time)) >= $waitingTime && !$connection){ echo ("<p> Server not responding for <strong>$t</strong> seconds !! </p>"); die("Connection aborted"); } } register_tick_function("checkConnection"); $time = time(); declare (ticks=1) { while( true ){ // connecting to loaded server } $connection = true ; } ?> --was-- check loaded server connection $connection = false; function checkConnection( $connectionWaitingTime = 3 ) { // check connection & time global $time,$connection; if( ($t = (time() - $time)) >= $waitingTime && !$connection){ echo ("<p> Server not responding for <strong>$t</strong> seconds !! </p>"); die("Connection aborted"); } } register_tick_function("checkConnection"); $time = time(); declare (ticks=1) { while( true ){ // connecting to loaded server } $connection = true ; } http://php.net/manual/en/control-structures.declare.php

« previous php.notes (#175071) next »