Return connection status:
<?phpswitch (connection_status()){case CONNECTION_NORMAL: $txt = 'Connection is in a normal state'; break;case CONNECTION_ABORTED: $txt = 'Connection aborted'; break;case CONNECTION_TIMEOUT: $txt = 'Connection timed out' ; break;case (CONNECTION_ABORTED & CONNECTION_TIMEOUT): $txt = 'Connection aborted and timed out'; break;default: $txt = 'Unknown'; break;}echo $txt;?>The connection_status() function returns the current connection status.
Possible values that can be returned:
0 - CONNECTION_NORMAL - The connection is operating normally
1 - CONNECTION_ABORTED - The connection was terminated by user or network error
2 - CONNECTION_TIMEOUT - Connection timeout
3 - CONNECTION_ABORTED & CONNECTION_TIMEOUT
connection_status()
Return value: | Returns the connection status bit field. |
---|---|
PHP version: | 4+ |