YouTip LogoYouTip

Func Misc Exit

PHP exit() Function |

-- Learning is not just about technology, but also about dreams!

PHP Tutorial

PHP Tutorial PHP Introduction PHP Installation PHP Syntax PHP Variables PHP echo/print PHP EOF(heredoc) PHP Data Types PHP Type Comparisons PHP Constants PHP Strings PHP Operators PHP If...Else PHP Switch PHP Arrays PHP Array Sorting PHP Superglobals PHP While Loop PHP For Loop PHP Functions PHP Magic Constants PHP Namespaces PHP OOP PHP Quiz

PHP Forms

PHP Forms PHP Form Validation PHP Form - Required Fields PHP Form - Validate Email and URL PHP Complete Form Example PHP $_GET Variable PHP $_POST Variable

PHP Advanced Tutorial

PHP Multidimensional Arrays PHP Date PHP Includes PHP Files PHP File Upload PHP Cookies PHP Sessions PHP E-mail PHP Secure E-mail PHP Error PHP Exception PHP Filters PHP Advanced Filters PHP JSON

PHP 7 New Features

PHP 7 New Features

PHP Database

PHP MySQL Introduction PHP MySQL Connect PHP MySQL Create Database PHP MySQL Create Table PHP MySQL Insert Data PHP MySQL Insert Multiple Data PHP MySQL Prepared Statements PHP MySQL Read Data PHP MySQL Where PHP MySQL Order By PHP MySQL Update PHP MySQL Delete PHP ODBC

PHP XML

XML Expat Parser XML DOM XML SimpleXML

PHP and AJAX

AJAX Introduction AJAX PHP AJAX Database AJAX XML AJAX Live Search AJAX RSS Reader AJAX Poll

PHP Reference Manual

PHP Array PHP Calendar PHP cURL PHP Date PHP Directory PHP Error PHP Filesystem PHP Filter PHP FTP PHP HTTP PHP Libxml PHP Mail PHP Math PHP Misc PHP MySQLi PHP PDO PHP SimpleXML PHP String PHP XML PHP Zip PHP Timezones PHP Image Processing PHP RESTful PHP PCRE PHP Available Functions PHP Composer

PHP 5 Math Functions

PHP 5 MySQLi Functions

PHP exit() Function

PHP Misc Reference PHP Misc Reference

Example

Output a message and exit the current script:

<?php

$site = "http://www.w3cschool.cc/";

 fopen($site,"r")

 or exit("Unable to connect to $site");

 ?>

Definition and Usage

The exit() function outputs a message and exits the current script.

This function is an alias of the die() function.


Syntax

exit(message)
Parameter Description
message Required. Specifies the message or status number to write before exiting the script. The status number is not written to the output.

Technical Details

Return Value: No value is returned.
PHP Version: 4+

PHP Misc Reference PHP Misc Reference

← Func Mysqli ConnectFunc Misc Eval β†’