我有一个foreach循环和一个if语句。如果找到比赛,我需要最终突破。
foreach($equipxml as $equip) {
    $current_device = $equip->xpath("name");
    if ( $current_device[0] == $device ) {
        // found a match in the file            
        $nodeid = $equip->id;
        <break out of if and foreach here>
    }       
}
                  对于PHP不是JS。我不能认为他们的行为相同。
                
                
                  
                    —
                    au_stan 2012年
                    
                  
                
              
                  gee-我必须停止使用jQuery了。为什么这会引起反对?+1,完全合理且恰当的问题。
                
                
                  
                    —
                    mrtsherman '02 
                    
                  
                
              
                  我之所以只问这个问题,是因为(出于任何原因)我无法绕过php break文档及其示例。一切都很好。我不是在这里获得徽章和积分,只是好的答案。
                
                
                  
                    —
                    au_stan 2012年