Change language

PHP Connection_status () function

Syntax:
int connection_status (void)
Parameters:This function takes no parameters.Return Value:This function returns a bit-field for the connection status. Possible values ​​for the returned connection status bit field:
  • 0:CONNECTION_NORMAL - works fine
  • 1:CONNECTION_ABORTED - user or network error interrupted
  • 2:CONNECTION_TIMEOUT - timed out
  • 3:CONNECTION_ABORTED & amp; CONNECTION_TIMEOUT - interrupted and timed out
Note.This feature is available for PHP 4.0.0 and later.The following programs illustrate the connection_status() functionin PHP.Program 1: switch (connection_status()) { case CONNECTION_ABORTED: echo ’Connection aborted’ ; break ; case CONNECTION_TIMEOUT: echo ’Connection timed out’ ; break ; case CONNECTION_NORMAL: echo ’Connection is in a normal state’ ; break ; case (CONNECTION_ABORTED & amp; CONNECTION_TIMEOUT): echo ’Connection aborted and timed out’ ; break ; default : echo ’Unknown’ ; break ; }
?>
Output:
Connection is in a normal state
Program 2:Some output is sent to the browser so that connection_status()works if it breaks or close.  
// This will work even if the browser is broken or closed
// Send this to the client browser switch (connection_status()) { case CONNECTION_ABORTED: echo ’Connection aborted ’ ; break ; case CONNECTION_TIMEOUT: echo ’Connection timed out’ ; break ; case CONNECTION_NORMAL: echo ’Connection is in a normal state’ ; break ; case (CONNECTION_ABORTED & amp; CONNECTION_TIMEOUT): echo ’Connection aborted and timed out’ ; break ; default : echo ’Unknown’ ; break ; }
?>
Output:
Connection is in a normal state
Link: https://www.php.net/manual/en/function.connection-status.php

Shop

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Best laptop for engineering student

$

Best laptop for development

$

Best laptop for Cricut Maker

$

Best laptop for hacking

$890

Best laptop for Machine Learning

$950

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method