Current Location: Home> Function Categories> connection_status

connection_status

Return to the status bit of the connection
Name:connection_status
Category:Miscellaneous
Programming Language:php
One-line Description:Returns the current connection status.

Definition and usage

connection_status() function returns the current connection status.

Possible values ​​that can be returned:

  • 0 - CONNECTION_NORMAL - The connection is running normally
  • 1 - CONNECTION_ABORTED - The connection is terminated by a user or network error
  • 2 - CONNECTION_TIMEOUT - Connection timeout
  • 3 - CONNECTION_ABORTED & CONNECTION_TIMEOUT - The connection is aborted and timed out

Example

Return to the connection status:

 <?php  
switch ( connection_status ( ) )  
{  
case CONNECTION_NORMAL :  
  $txt = 'Connection status is normal' ;  
  break ;  
case CONNECTION_ABORTED :  
  $txt = 'Connection aborted' ;  
  break ;  
case CONNECTION_TIMEOUT :  
  $txt = 'Connection timeout' ;  
  break ;  
case ( CONNECTION_ABORTED & CONNECTION_TIMEOUT ) :  
  $txt = 'Connection aborted and timed out' ;  
  break ;  
default :  
  $txt = 'Unknown' ;  
  break ;  
}  
  
echo $txt ;  
?>

Try it yourself

grammar

 connection_status ( )
Similar Functions
Popular Articles