【发布时间】:2017-06-09 21:25:27
【问题描述】:
我有这个 JSON 数据:
[{"make":"Cadillac","model":"Escalade","year":"2006"},{"make":"Cadillac","model":"Escalade","year":"2005"},{"make":"Cadillac","model":"Escalade","year":"2004"},{"make":"Cadillac","model":"Escalade","year":"2003"},{"make":"Cadillac","model":"Escalade","year":"2002"},{"make":"Cadillac","model":"Escalade ESV","year":"2006"},{"make":"Cadillac","model":"Escalade ESV","year":"2005"},{"make":"Cadillac","model":"Escalade ESV","year":"2004"},{"make":"Cadillac","model":"Escalade ESV","year":"2003"},{"make":"Cadillac","model":"Escalade EXT","year":"2006"},{"make":"Cadillac","model":"Escalade EXT","year":"2005"},{"make":"Cadillac","model":"Escalade EXT","year":"2004"},{"make":"Cadillac","model":"Escalade EXT","year":"2003"},{"make":"Cadillac","model":"Escalade EXT","year":"2002"},{"make":"Chevrolet","model":"Astro","year":"2005"},{"make":"Chevrolet","model":"Astro","year":"2004"},{"make":"Chevrolet","model":"Astro","year":"2003"},{"make":"Chevrolet","model":"Avalanche 1500","year":"2006"},{"make":"Chevrolet","model":"Avalanche 1500","year":"2005"}]
如何对数据格式进行排序。
Cadillac Escalade 07-13
Cadillac Escalade ESV 07-13
Cadillac Escalade EXT 07-13
Cadillac XTS 2013
Chevrolet Avalanche 07-13
Chevrolet Express 1500 09-14
我对 PHP 还很陌生,所以我很难弄清楚如何实现这一点并删除重复项以及通过串联添加年份。
谢谢,
【问题讨论】:
-
什么是
07-13?它不会出现在您的 json 数据中 -
通过串联添加年份。
标签: php arrays json sorting search