我打破了我的头排序数组与关键字值。与此以下数组,我需要排序这个由网站_类别,我需要有这样的输出
示例:
Shopping
Amazon
Social
Amoeblo
American express
数组值为
(
[0] => stdClass Object
(
[site_id] => 1
[site_name] => Amazon
[site_img] => http://localhost/faves/resource/img/sites/icon/amazon.png
[site_category] => Shopping
)
[1] => stdClass Object
(
[site_id] => 2
[site_name] => Ameblo
[site_img] => http://localhost/faves/resource/img/sites/icon/ameblow.png
[site_category] => Social
)
[2] => stdClass Object
(
[site_id] => 3
[site_name] => American Express
[site_img] => http://localhost/faves/resource/img/sites/icon/americanexpress.png
[site_category] => Social
)
)
对此有何建议?
3条答案
按热度按时间xnifntxz1#
实际上是Sort php multidimensional array by sub-value的副本
06odsfpq2#
您可以使用foreach和ksort来完成此操作
将$your_array设为上面提到的数组
或者在php中搜索multisort,这将解决您的问题:)
djmepvbi3#
这将按照价格键对
$carriers
数组进行排序。