Parsing php die (), exit (), return difference _php tips
Source: Internet
Author: User
die ()Stop program running, output content
Exitis to stop the program running without outputting the content
returnis the return value
dieis to stop if you encounter an error
Exitis to stop directly and do not run subsequent code, exit () can display the content.
returnis purely a return value, but will not run subsequent code
exit (0):Normal operation of the program and exit the program;
exit (1):Abnormal operation causes the exit procedure;
Return ():Returns a function that, if it is in the main function, exits the function and returns a value.
Detailed said: 1. returnReturns the value of the function, which is the keyword; exit is a function.
2. returnis language-level, which represents the return of the call stack, and exit is the system call level, which represents the end of a process.
3. returnis the exit (return) of the function, and exit is the process.
4. returnis provided by the C language, and exit is provided by the operating system (or given in the function library).
5. returnUsed to end the execution of a function, to use the function's execution information out of other calling functions; the exit function exits the application, deletes the memory space used by the process, and returns a state of the application to the OS, which identifies some running information about the application, which is related to the machine and the operating system, Generally 0 for normal exit, not 0 for abnormal exit.
6. Calls in non-primary functions
returnAnd
ExitThe effect is obvious, but in
Mainfunction to call the
returnAnd
ExitThe phenomenon is very vague, in most cases, the phenomenon is consistent
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.