Home  >  Article  >  Backend Development  >  The difference between exit and return, the difference between exit and return_PHP tutorial

The difference between exit and return, the difference between exit and return_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 09:06:29921browse

The difference between exit and return, the difference between exit and return

There are several main differences: ​ 1. return returns a function value, which is a keyword; exit is a function. ​ 2. Return is at the language level, which represents the return of the call stack; exit is at the system call level, which represents the end of a process. ​ 3. Return is the exit (return) of the function; exit is the exit of the process. ​ 4. Return is provided by the C language, and exit is provided by the operating system (or given in the function library). ​ 5. return is used to end the execution of a function and transfer the execution information of the function to other calling functions; the exit function is to exit the application, delete the memory space used by the process, and return a status of the application to OS, this status identifies some running information of the application. This information is related to the machine and operating system. Generally, 0 means a normal exit, and non-0 means an abnormal exit. ​ 6. The effect of calling return and exit in non-main function is very obvious, but the phenomenon of calling return and exit in main function is very vague. In most cases, the phenomenon is the same. ​ You can clearly see the difference between vfork and fork: you can try to type the program and experience the specific difference.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1064938.htmlTechArticleThe difference between exit and return. The main differences between exit and return are as follows: 1. return returns a function value, is a keyword; exit is a function. 2. Return is at the language level, which represents...
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