$arr2=array(
Array(12,23,34,45),
Array (34,45,67,89),
Array(56,78,90,1)
)
예 위대한 스승은 없습니다
Ray2023-10-18 17:00:18
<?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;