基本上我有这个代码场景:
if($_SESSION['player_1_pawn'][0]['currentHealth'] <=0 &&
$_SESSION['player_1_pawn'][1]['currentHealth'] <=0 &&
$_SESSION['player_1_pawn'][2]['currentHealth'] <=0 &&
$_SESSION['player_1_pawn'][3]['currentHealth'] <=0 &&
$_SESSION['player_1_pawn'][4]['currentHealth'] <=0) {
//some code here
}
['player_1_pawn'][index]['currentHealth']
如果 all小于0
,是否有任何方法可以检查或遍历所有索引,
而不是像我发布的那样一一编写?