3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $ar = Array ( 0 => Array ( 'name' => "The 5th Wave", 'releaseDate' => '2016-01-22', 'dates' => Array ( 'date' => Array ( 0 => '2016-01-27', 1 => '2016-01-26' ) ) ), 1 => Array ( 'name' => 'Dirty Grandpa', 'releaseDate' => '2016-01-21', 'dates' => Array ( 'date' => Array ( 0 => '2016-01-27', 1 => '2016-01-26' ) ) ), 2 => Array ( 'name' => 'The Revenant', 'releaseDate' => '2016-01-14', 'dates' => Array ( 'date' => Array ( 0 => '2016-01-27', 1 => '2016-01-26' ) ) ) ); print_r($ar); echo "================Sort============="; $uasort($ar, function($a, $b){ if( end($array['dates']['date']) < $array['releaseDate'] OR end($a['dates']['date']) > date("Y-m-d", strtotime('next thursday')) ){ return -1; } else{ return 0; } }); print_r($ar);
based on PoWTA
Output for 7.0.0 - 7.2.0
Array ( [0] => Array ( [name] => The 5th Wave [releaseDate] => 2016-01-22 [dates] => Array ( [date] => Array ( [0] => 2016-01-27 [1] => 2016-01-26 ) ) ) [1] => Array ( [name] => Dirty Grandpa [releaseDate] => 2016-01-21 [dates] => Array ( [date] => Array ( [0] => 2016-01-27 [1] => 2016-01-26 ) ) ) [2] => Array ( [name] => The Revenant [releaseDate] => 2016-01-14 [dates] => Array ( [date] => Array ( [0] => 2016-01-27 [1] => 2016-01-26 ) ) ) ) ================Sort============= Notice: Undefined variable: uasort in /in/WcbXT on line 54 Fatal error: Uncaught Error: Function name must be a string in /in/WcbXT:54 Stack trace: #0 {main} thrown in /in/WcbXT on line 54
Process exited with code 255.
Output for 5.5.0 - 5.6.28
Array ( [0] => Array ( [name] => The 5th Wave [releaseDate] => 2016-01-22 [dates] => Array ( [date] => Array ( [0] => 2016-01-27 [1] => 2016-01-26 ) ) ) [1] => Array ( [name] => Dirty Grandpa [releaseDate] => 2016-01-21 [dates] => Array ( [date] => Array ( [0] => 2016-01-27 [1] => 2016-01-26 ) ) ) [2] => Array ( [name] => The Revenant [releaseDate] => 2016-01-14 [dates] => Array ( [date] => Array ( [0] => 2016-01-27 [1] => 2016-01-26 ) ) ) ) ================Sort============= Notice: Undefined variable: uasort in /in/WcbXT on line 54 Fatal error: Function name must be a string in /in/WcbXT on line 54
Process exited with code 255.