Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the ways in which the PHP function exits the script?

Shulou Source: shulou.com Published: 2022-06-03 17:26:32 10月04日 Update

This article will explain in detail about the methods of PHP function to exit the script program, the editor thinks it is very practical, so share it for you to do a reference, I hope you can get something after reading this article.

1. The names exit and die point to the same function. Die () is an alias for exit (), and the two functions are essentially the same.

2. The die () and exit () functions take the optional parameter $message, which is used to output messages when exiting the current script.

Exit ($message); die ($message)

$message can be a specific numeric value (type int) or a string (type String), or it can be entered without any parameters.

If int, the value will be used as the exit status code and will not be printed out. The value of the exit status code ranges from 0 to 254. )

Note: do not use the exit status code reserved by PHP. The status code 0 is used to successfully abort the program.

This is the end of this article on "what are the ways for PHP functions to exit script programs?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Tags: Functions states programs scripts articles types methods two parameters more output good practical successful between content aliases names characters strings Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Xiaomi OPPO Reno Shulou Tech Info Redmi