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