X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

PHP connection_status() Function

PHP Misc Reference PHP Misc Reference

Example

Return the connection satus:

<?php
switch (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;
?>

Run example »

Definition and Usage

The connection_status() function returns the current connection status.

Possible values that can be returned are:

  • 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

Syntax

connection_status()

Technical Details

Return Value: Returns the connection status bitfield
PHP Version: 4+


PHP Misc Reference PHP Misc Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook