$arr2=array(
Array(12,23,34,45),
Array (34,45,67,89),
Array(56,78,90,1)
)
Oui Il n'y a pas de grand maître
<?php
$arr2 = array( array(12, 23, 34, 45), array(34, 45, 67, 89), array(56, 78, 90, 1) ); $sum = 0; // 遍历 foreach ($arr2 as $subArray) { // 遍历 foreach ($subArray as $value) { // 判断奇数项 if ($value % 2 != 0) { $sum += $value; } } } echo $sum;
<?php