- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
connection_status() function in PHP
The connection_status() function returns the connection status.
Syntax
connection_status()
Parameters
NA
Return
The connection_status() function returns the following possible values. This is the status bitfield −
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
Example
The following is an example −
<?php switch (connection_status()) { case CONNECTION_NORMAL: $msg = 'Connection is in a normal state!'; break; case CONNECTION_ABORTED: $msg = 'Connection aborted!'; break; case CONNECTION_TIMEOUT: $msg = 'Connection timed out!'; break; case (CONNECTION_ABORTED & CONNECTION_TIMEOUT): $msg = 'Connection aborted and timed out!'; break; default: $msg = 'Status is unknown!'; break; } echo $msg; ?>
Advertisements