W3Schools.com

PHP connection_status() Function


PHP Misc Reference Complete PHP Misc Reference

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()


Example

<?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;
?>


PHP Misc Reference Complete PHP Misc Reference
WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$7.95/mo SEO Hosting
Premium Website Design
WEB BUILDING
XML Editor - Free Trial!
FREE Website BUILDER
Free Website Templates Free CSS Templates
Make Your Own Website
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE