The difference between jumping out of the loop in PHP break,continue,return,exit

Source: Internet
Author: User

Tag: Div declaration is now a callback data type one loop exit

1. The function of the return statement (1) returns to exit from the current method, returning to the statement of the method of the call, to continue execution.      (2) return returns a value to the statement that invokes the method, and the data type of the return value must match the type of the return value in the declaration of the method. (3) Return back can also be without parameters, without parameters is returned empty, in fact, the main purpose is to interrupt the function execution, return to the calling function.    2. Break statement function (1) break in the loop body, forcibly end the execution of the loop, that is, the end of the entire loop process, not to determine whether the condition of the execution loop is established, directly to the statement below the circular statement. (2) When break appears in the body of the switch statement in the loop body, its function is simply to jump out of the switch statement body. 3. The function of the continue statement terminates the execution of this loop, that is, the statement that has not been executed after the continue statement in the current loop is skipped, and then the next cycle condition is judged. 4. Exit function exit All scripts, is a function.

The difference between jumping out of the loop in PHP break,continue,return,exit

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.