这是我当前的数组结构:
array(2) {
["Ground"] => array(4) {
[0] => object(Shipping\Model\Shipping)#337 (5) {
["shipping_id"] => NULL
["min_weight"] => string(4) "0.00"
["max_weight"] => string(4) "5.00"
["shipping_method"] => string(6) "Ground"
["shipping_rate"] => string(4) "8.00"
}
[1] => object(Shipping\Model\Shipping)#385 (5) {
["shipping_id"] => NULL
["min_weight"] => string(4) "6.00"
["max_weight"] => string(5) "10.00"
["shipping_method"] => string(6) "Ground"
["shipping_rate"] => string(5) "12.00"
}
}
["Expedited"] => array(4) {
[0] => object(Shipping\Model\Shipping)#388 (5) {
["shipping_id"] => NULL
["min_weight"] => string(4) "0.00"
["max_weight"] => string(4) "5.00"
["shipping_method"] => string(9) "Expedited"
["shipping_rate"] => string(5) "12.00"
}
}
}
每次我为 max_weight
运行 array_column
时,都会得到一个空数组。我应该将返回的数组用于 max()
。
有解决方法吗?
最佳答案
v7.0.0: Added the ability for the input parameter to be an array of objects.
来源:https://secure.php.net/manual/en/function.array-column.php
关于php - array_column 不适用于对象数组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48178161/