可能的重复:对象数组
排序
在php中对对象数组进行排序
编辑:这是一个重复的问题。关闭这个
我有一个对象数组存储在 $articles 中,它们不一定以任何特定的顺序返回。我正在尝试根据 idarticles 对对象进行排序。我知道如何在 javascript 中执行此操作,但不知道如何在 PHP 中执行此操作。这是一个示例响应。为了便于阅读,我用 json_encode 回应了它。任何帮助都会很棒
[
{
"idarticles":"61",
"full_text":"",
"main_image":"",
"tags":null,
"url":null,
"summary":null,
"title":"No Title Given"
},
{
"idarticles":"64",
"full_text":"",
"main_image":"http:\/\/i2.cdn.turner.com\/cnn\/dam\/assets\/121014085050-11-stratos-1014-horizontal-gallery.jpg",
"tags":"Sound,New Mexico,Maxima and minima",
"url":"some string",
"summary":"text",
"title":"text"
},
{
"idarticles":"63",
"full_text":"",
"main_image":"http:\/\/i2.cdn.turner.com\/cnn\/dam\/assets\/121014085050-11-stratos-1014-horizontal-gallery.jpg",
"tags":"Sound,New Mexico,Maxima and minima",
"url":"some string",
"summary":"text",
"title":"text"
}
]