The connection_status() function returns the connection status.
Syntax
connection_status()
Parameters
NA
Return
The connection_status() function returns the following possible values. This is the status bitfield −
0 - CONNECTION_NORMAL - connection is running normally
1 - CONNECTION_ABORTED - connection is aborted by user or network error
2 - CONNECTION_TIMEOUT - connection timed out
3 - CONNECTION_ABORTED & CONNECTION_TIMEOUT
Example
The following is an example −
<?php
switch (connection_status()) {
case CONNECTION_NORMAL:
$msg = 'Connection is in a normal state!';
break;
case CONNECTION_ABORTED:
$msg = 'Connection aborted!';
break;
case CONNECTION_TIMEOUT:
$msg = 'Connection timed out!';
break;
case (CONNECTION_ABORTED & CONNECTION_TIMEOUT):
$msg = 'Connection aborted and timed out!';
break;
default:
$msg = 'Status is unknown!';
break;
}
echo $msg;
?>