3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array( array( 'label' => 'AA', 'start' => '2015-09-05 14:14:14' ), array( 'label' => 'DD', 'start' => '2015-09-14 14:14:14' ), array( 'label' => 'EE', 'start' => '2016-09-05 14:14:14' ), array( 'label' => 'BB', 'start' => '2015-09-08 00:00:00' ), array( 'label' => 'CC', 'start' => '2015-09-08 01:14:14' ), ); usort($a, function($a, $b) { $a = strtotime($a); $b = strtotime($b); if ($a == $b) { return 0; } return ($a < $b) ? -1 : 1; }); var_dump($a);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: strtotime(): Argument #1 ($datetime) must be of type string, array given in /in/AqZGY:26 Stack trace: #0 /in/AqZGY(26): strtotime(Array) #1 [internal function]: {closure}(Array, Array) #2 /in/AqZGY(25): usort(Array, Object(Closure)) #3 {main} thrown in /in/AqZGY on line 26
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
47.19 ms | 401 KiB | 8 Q