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
  • Return to the status bit of the connection connection_status

    connection_status

    Returntothestatusbit
  • Check if a constant with a name exists defined

    defined

    Checkifaconstantwith
  • Output a message and exit the current script exit

    exit

    Outputamessageandexi
  • Alias ​​of highlight_file show_source

    show_source

    Alias​​ofhighlight_f
  • Package data into binary strings pack

    pack

    Packagedataintobinar
  • Define a constant define

    define

    Defineaconstant
  • Execute strings as PHP code eval

    eval

    ExecutestringsasPHPc
  • Return the value of a constant constant

    constant

    Returnthevalueofacon
Popular Articles