【发布时间】:2012-02-22 04:22:15
【问题描述】:
我有一个多维数组设置如下
array() {
["type1"] =>
array() {
["ticket1"] =>
array(9) {
// ticket details here
}
["ticket2"] =>
array(10) {
// ticket details here
}
["ticket3"] =>
array(9) {
// ticket details here
}
}
["type2"] =>
array() {
["ticket1"] =>
array(9) {
// ticket details here
}
["ticket2"] =>
array(10) {
// ticket details here
}
["ticket3"] =>
array(9) {
// ticket details here
}
}
}
等等
我正在尝试计算数组中的票证总数(二级项目的数量),但类型的数量是可变的,因为每张票证的字段数也是可变的,所以我不能使用 COUNT_RECURSIVE和数学来得到这个数字。
谁能帮帮我?
【问题讨论】:
-
@MadaraUchiha 在循环中添加计数(以最好的为准)可能会更好,因为您不必迭代所有内容。
标签: php multidimensional-array