3v4l.org

run code in 300+ PHP versions simultaneously
<?php $attachments = [ [ "year" => 2018, "id" => 14689 ], [ "year" => 2017, "id" => 14690 ], [ "year" => 2018, "id" => 14688 ], [ "year" => 2018, "id" => 14687 ] ]; usort($attachments, function ($first, $second) { return $first["year"] < $second["year"]; }); print_r($attachments);

preferences:
26.41 ms | 405 KiB | 5 Q