Return, break, and contiue are language structures, just like if statements, but exit is a function. 1. function of exit: Outputamessageandterminatethecurrentscript outputs a message and terminates the current script. If a piece of text contains multiple... "/> <scripttype =" tex return, break, and contiue are language structures, such as if statements, but exit is a function. 1. function of exit: Output a message and terminate the current script. If a piece of text contains multiple End script, exit all scripts. For example, if a php text contains code, it is not output as world. Syntax format: void indicates no return value. Void exit ([string $ status]) void exit (int $ status) If status is a string, this function prints the status just before exiting. if status is a string, this function prints status before the script exits. If status is an integer, that value will also be used as the exit status. exit statuses shoshould be in the range 0 to 254, the exit status 255 is reserved by PHP and shall not be used. the status 0 is used to terminate the program successfully. if status is an integer, the integer is used as the exit status. The exit status should be from 0 to 254. exit status 255 is retained and disabled by PHP. Status 0 is used to indicate successful termination of the program. 2. return: terminate the execution of the function and return a value from the function. 3. break and continue are used in for, foreach, while, do .. while or switch structure. Break ends the execution of the current for, foreach, while, do... while or switch structure. The break can accept an optional numeric parameter to determine the number of loops to jump out. Code: \ N ";}$ I = 0; while (++ $ I) {switch ($ I) {case 5: echo" At 5
\ N "; break 1; case 10: echo" At 10; quitting
\ N "; break 2; default: break ;}}?> Continue is used in the loop structure to skip the remaining code in this loop and start to execute the next loop of this loop structure. Note: In PHP, the switch statement is considered as a loop structure for the purpose of continue. Continue accepts an optional numeric parameter to decide to skip multiple cycles to the end of the loop. Code: \ N "; while (1) {echo" Middle
\ N "; while (1) {echo" Inner
\ N "; continue 3;} echo" This never gets output.
\ N ";} echo" Neither does this.
\ N ";}?>
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.