我有一个如下所示的示例对象数组,它是一个 json 解码数组。该对象数组中的索引 value1,value2,value3 将来可以增长到 value'n' 。我需要获取此对象数组中索引出现次数的计数。我怎样才能实现这一点?我正在使用 PHP 5.6
stdClass Object(
[general_rates] => Array
(
[0] => stdClass Object
(
[id] => 1
[item] => Item name
[cost1] =>
[cost2] =>
[cost3] => 60
)
[1] => stdClass Object
(
[id] => 2
[item] =>
[cost1] => N/A
[cost2] => N/A
[cost3] => 60
)
)
[value1] => EUROPE
[value2] => AMERICA
[value3] => FRANCE
)
慕的地10843
一只甜甜圈