[Split] the difference between exit () and die

Source: Internet
Author: User
[Split] the difference between exit () and die 1. what are the essential differences between exit () and die?
2. which one do you often use during coding or project debugging?
3. is exit () or die used for convenience or other reasons?

Let's talk about it!

By the way, scatter points!


Reply to discussion (solution)

The manual makes it clear that

Die? Equivalent to exit ()

There is no difference in interruptions, by the way.

The die () function outputs a message and exits the current script.
This is the alias of the exit () function.


Why is this meaningless thing tangled?

Use exit () and die () to find it hard to hear ~~
Paste it to the score ~~

Generally, exit () is used, and die is used occasionally. the actual difference has not been further explored.

The die () function outputs a message and exits the current script.
This is the alias of the exit () function.
If status is a string, the function outputs the string before exiting.
If status is an integer, this value is used as the exit status. The exit status ranges from 0 to 254. Exit status 255 is retained by PHP and will not be used. Status 0 is used to successfully terminate the program.
If PHP version is later than or equal to 4.2.0, this parameter is not output when status is an integer.

The difference between a prostitute and a bitch...

The difference between a prostitute and a bitch...
Haha what is the difference between a prostitute and a lady?

Come on, I will pick up the score. In fact, I don't know. a newbie is passing.

Exit () is different from die.
Die () stops running the program and outputs the content
Exit indicates that the program is stopped and no content is output.

Die stops only when an error occurs.
Exit is to stop directly without running the subsequent code. exit () can display the content.
Exit (0): The program runs normally and exits;
Exit (1): exit the program due to abnormal operation;
As to whether it makes sense, you can understand it only when it is used in the project...

Exit is the same as die.
Exit follows the c language, and die is unique to php.

Php recommends that you use die, but the author of the php manual reversed them.
Convert exit to the synonym of die.
The primary and secondary components are upside down, making people feel that the die is dispensable.
Actually not.
Many php practitioners switch over asp, and exit commands jump out of the loop in vbs instead of terminating the program.
Continuing to use exit is not conducive to the approval of php

Upstairs solution ~~~~~~~~~

Pick up the score.

Xu moderator Wei Wu!

Getting used to exit

Fast checkout

Alias, no difference

I prefer die

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.