// merge arrays and sort by datetime
$arr = array_merge($arr1, $arr2);
usort($arr, function($a, $b) {
$date1 = strtotime($a->datetime);
$date2 = strtotime($b->datetime);
return $date1 - $date2; // ascending order, swop around for descending order
});
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter