Return, break, and contiue are language constructs, just like an if statement, but exit is a function. 1.exit function: Output a message and terminate the current script outputs a piece of messages and terminates the active scripts. If a section of text includes multiple End of the script, exit exits all scripts. For example, a PHP text includes the code, then the output is not the 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 the status before the script exits. If status is a integer, that value would also be used as the exit status. Exit statuses should be in the range 0 to 254, the exit status 255 are reserved by PHP and shall not being used. The status 0 is used to terminate the program successfully. If the status is an integer, the integer will be used as the exit state. Exit status should be from 0 to 254, exit status 255 is reserved by PHP and is forbidden to use. Status 0 is used to indicate a successful termination program. The use of the 2.return language structure: Terminating the execution of a function and returning a value from the function 3.break and continue used in For,foreach,while,do. The while or switch structure. Break ends Current For,foreach,while,do: The execution of the while or switch structure. Break can accept an optional numeric parameter to decide to jump out of a few loops. 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;}}? The >continue is used in the loop structure to skip the remaining code in this loop and begin the next loop of the loop structure. Note: Notice that the switch statement in PHP is considered a looping structure for continue purposes. Continue accepts an optional numeric parameter to decide to skip a few loops 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 ";}?" >
http://www.bkjia.com/PHPjc/477121.html www.bkjia.com true http://www.bkjia.com/PHPjc/477121.html techarticle return, break, and contiue are language constructs, just like an if statement, but exit is a function. 1.exit functions: Output a message and terminate the current script outputs a ...