The exit() function is a built-in function in PHP that is used to output messages and terminate the current script. The exit() function only terminates the execution of the script. The syntax is exit(message), and the message to be displayed is passed as a parameter to the exit() function, which terminates the script and displays the message.
How to use the php exit() function?
exit() function outputs a message and exits the current script.
Syntax
exit(message)
Parameters:
message: Required. Specifies the message or status number to be written before exiting the script. Status numbers are not written to the output.
Return value: This function does not return any value.
Note:
1. exit() is a language structure. If no status is passed, it can be called without parentheses.
2. If the status passed as a parameter is an integer, the value will be used as the exit status without printing.
3. The exit status should be in the range of 0 to 254, and the exit status 255 should not be used because it is reserved by PHP.
Let’s take a look at how to use the php exit() function through an example.
Example
<?php header("content-type:text/html;charset=utf-8"); $a=5; $b=5.0; if($a==$b) { exit('变量相等'); } else { exit('变量不相等'); } ?>
Output:
变量相等
The above is the detailed content of How to use php exit function. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Zend Studio 13.0.1
Powerful PHP integrated development environment

Notepad++7.3.1
Easy-to-use and free code editor
