3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date_ranges = array( '7 Days Ago' => array( 'from' => new DateTime('7 days ago 00:00:00', $tz), 'to' => new DateTime('yesterday 23:59:59', $tz) ), 'Yesterday' => array( 'from' => new DateTime('yesterday 00:00:00', $tz), 'to' => new DateTime('yesterday 23:59:59', $tz) ), '30 Days Ago' => array( 'from' => new DateTime('30 days ago 00:00:00', $tz), 'to' => new DateTime('yesterday 23:59:59', $tz) ) ); usort($myArray, function($a, $b) { return $a['from']->getTimestamp() - $b['from']->getTimestamp(); }); print_r($date_ranges);

preferences:
31.57 ms | 402 KiB | 5 Q