[0] => stdClass Object
(
[jobtitle] => MUDLOGGER
[company] => Weatherford
[city] => South Jakarta
[state] => JK
[country] => ID
[formattedLocation] => South Jakarta
[source] => Weatherford
[date] => Tue, 03 Sep 2013 14:15:56 GMT
[onmousedown] => indeed_clk(this, '7414');
[latitude] => -6.266483
[longitude] => 106.8022
[jobkey] => a7490605224a8d72
[sponsored] =>
[expired] =>
[formattedLocationFull] => South Jakarta
[formattedRelativeTime] => 12 hari yang lalu
)
[1] => stdClass Object
(
[jobtitle] => Quality Assurance & Control
[company] => PT Indo Meco Primatama
[city] => Depok
[state] => JB
[country] => ID
[formattedLocation] => Depok
[source] => CareerBuilder
[date] => Fri, 13 Sep 2013 10:18:10 GMT
[[onmousedown] => indeed_clk(this, '7414');
[latitude] => -6.384615
[longitude] => 106.82967
[jobkey] => f1808c40b46eebaa
[sponsored] =>
[expired] =>
[formattedLocationFull] => Depok
[formattedRelativeTime] => 2 hari yang lalu
)
我的代码
for ($x = 0; $x <= 9; $x++) {
echo $data[$x]->date;
}
提前致谢
答案 0 :(得分:2)
您可以将其传递给您自己的排序功能
function sort_by_date($a, $b) {
$a = strtotime($a->date);
$b = strtotime($b->date);
return ($a < $b) ? -1 : 1;
}
uasort($array, 'sort_by_date');
答案 1 :(得分:1)
使用usort()
功能:
usort($data, function(stdClass $a, stdClass $b) {
$aDate = strtotime($a->date);
$bDate = strtotime($b->date);
if($aDate == $bDate) return 0;
return $aDate > $bDate ? 1 : -1;
});