3v4l.org

run code in 300+ PHP versions simultaneously
<?php $files = array('2014-Aug','2014-Jan','2013-Dec'); function sortFileNamesWithMonths($a,$b) { $a_date = DateTime::createFromFormat('Y-M'); $b_date = DateTime::createFromFormat('Y-M'); if ($a_date > $b_date) { return 1; } elseif ($a_date < $b_date) { return -1; } else { return 0; } } usort($files,'sortFileNamesWithMonths'); var_dump($files);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught ArgumentCountError: DateTime::createFromFormat() expects at least 2 arguments, 1 given in /in/OgpLb:6 Stack trace: #0 /in/OgpLb(6): DateTime::createFromFormat('Y-M') #1 [internal function]: sortFileNamesWithMonths('2014-Aug', '2014-Jan') #2 /in/OgpLb(17): usort(Array, 'sortFileNamesWi...') #3 {main} thrown in /in/OgpLb on line 6
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:
42.58 ms | 401 KiB | 8 Q