Is there a jump function between PHP code that is not a jump between pages

Source: Internet
Author: User
Is there a jump function between PHP code? Not a jump between pages

Like what:

$str = "";
$a =array (1,2,3,4,5,6);
$b =array (1,4,3,4,5,6);
$i = 0;
foreach ($a as $value) {
if ($a [$i]< $b [$i]) {
If the condition satisfies, exits the loop, executes the final output directly "the data has the problem";
}else{
$str = "aaaa=". $a [$i];
}
$i + +;
}

echo "problem with data";


Reply to discussion (solution)

Break

if ($a [$i]< $b [$i]) {       echo "data is problematic";//if the condition is satisfied, exit the loop and execute the final output "data problem" directly;       Exit ();    } ...

Maybe my example doesn't express my situation.

if () {//There are many more like this, the following code is $str= "" in many if.  $a =array (1,2,3,4,5,6), $b =array (1,4,3,4,5,6), $i =0;foreach ($a as $value) {    if ($a [$i]< $b [$i]) {       //If conditions are met, Exits the loop, directly executes the final output "data is problematic";    } else{      $str = "aaaa=". $a [$i];      

if ($condition) {
Die ("Problem with Data");
}

Correct usage is if (set) {    do something} else {   do something else}//your usage is if (set up) {   go do something} else {do something else} {  don't want to do}}


$str = "";  $a =array (1,2,3,4,5,6), $b =array (1,4,3,4,5,6), $i =0;foreach ($a as $value) {    if ($a [$i]< $b [$i]) {       Xiangzuode ();//If the condition satisfies the call to do;       Break;//'s done, get out!    }else{      $str = "aaaa=". $a [$i];      } $i + +;}  function Buzuode () {    //do not want to do, when to do what to call}  function Xiangzuode () {///want to do   
  • 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.