如何成功输入'if'条件后如何转到'else if'循环

时间:2011-11-09 05:05:40

标签: php

成功输入else if条件后,有没有办法转到if机构? 在成功输入else if条件后,有没有办法转到if机构?

    if ($axisX == $axisXOne) {   /* Main IF Statement */
            if($axisY =='0' && $axisYOne == '1') { $second = '2';}
        else if($axisY =='0' && $axisYOne == '2') { $second = '1';}
        else if($axisY =='1' && $axisYOne == '0') { $second = '2';}
        else if($axisY =='1' && $axisYOne == '2') { $second = '0';}
        else if($axisY =='2' && $axisYOne == '0') { $second = '1';}
        else if($axisY =='2' && $axisYOne == '1') { $second = '0';}

            if (($_POST['button'.$axisX.$second] == null) && ($curVal != $axisX.$second)){ /* Inner IF Statement */
             echo $axisX.$second; 
             }
    }   
    else if ($axisY == $axisYOne) {  /* Main ELSE IF statement */
        if($axisX =='0' && $axisXOne == '1') { $second = '2';}
        else if($axisX =='0' && $axisXOne == '2') { $second = '1';}
        else if($axisX =='1' && $axisXOne == '0') { $second = '2';}
        else if($axisX =='1' && $axisXOne == '2') { $second = '0';}
        else if($axisX =='2' && $axisXOne == '0') { $second = '1';}
        else if($axisX =='2' && $axisXOne == '1') { $second = '0';}
            if($_POST['button'.$second.$axisY] == null) {/* Inner IF Statement */
              echo $second.$axisY;
             }
    }
    else if ($xAxis == $yAxis && $xAxisOne == $yAxisOne) {  /* other Main ELSE IF Statement*/
            if($comVal[0] == '00' && $comVal[1] == '11') { $diagon = '22';}
        else if($comVal[0] == '00' && $comVal[1] == '22') { $diagon = '11';}
        else if($comVal[0] == '11' && $comVal[1] == '00') { $diagon = '22';}
        else if($comVal[0] == '11' && $comVal[1] == '22') { $diagon = '00';}
        else if($comVal[0] == '22' && $comVal[1] == '00') { $diagon = '11';}
        else if($comVal[0] == '22' && $comVal[1] == '11') { $diagon = '00';}
            if($_POST['button'.$diagon] == null) {
            echo $diagon;
            }
    }

如果主要IF语句评估为真和内部IF语句evalautes为假,则转到主ELSE IF梯形图。如果主要IF语句评估为真,并且内部IF语句evalautes为true,则停止循环。如果主要IF语句评估为假,则直接转到主要ELSE IF语句

如果Main ELSE IF Statement评估为true且Inner IF Statement evalautes为false,则转到Main ELSE IF ladder。如果Main ElSE IF Statement评估true和Inner IF Statement evalautes为true,则停止循环。如果Main ELSE IF Statement评估为false,则直接转到其他Main ELSE IF语句

1 个答案:

答案 0 :(得分:1)

试试这个:

$success = true;

if($a == $Xaxis && $b == $yaxis) {
    $zAxis    = $Xaxis + $yaxis;
    $success  = $Xaxis != $zAxis;
}
if( ($b == $Xaxis && $a == $yaxis) || !$success) {
    // do stuff here
}

或类似的东西。