Home  >  Article  >  Backend Development  >  What does exit mean in php?

What does exit mean in php?

WBOY
WBOYOriginal
2022-06-24 15:36:353985browse

In PHP, exit means exit; the exit() function is used to output a message and exit the current script. It is an alias of the die() function, and the syntax is "exit(message)"; where The parameter specifies a message or status number to be written before exiting the script, and the status number will not be written to the output.

What does exit mean in php?

The operating environment of this article: Windows 10 system, PHP version 8.1, Dell G3 computer

What does exit mean in php

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

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

Syntax

exit(message)

message Required. Specifies the message or status number to be written before exiting the script. Status numbers are not written to the output.

If message is a string, the function will output the string before exiting.

If message is an integer, this value will be used as the exit status. The exit status value is between 0 and 254. Exit status 255 is reserved by PHP and will not be used. Status 0 is used to terminate the program successfully.

Return value: No return value.

Examples are as follows:

<?php
$site = "http://www.w3school.com.cn/";
fopen($site,"r")
or exit("Unable to connect to $site");
?>

Recommended learning: "

PHP Video Tutorial"

The above is the detailed content of What does exit mean in php?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn