3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ [ 'date' => '2012-01-10', 'result' => 65, 'name' => 'Les océans', ], [ 'date' => '2012-01-11', 'result' => 75, 'name' => 'Les mers', ], [ 'date' => '2012-01-13', 'result' => 66, 'name' => 'Les continents', 'type' => 'Scores', ] ]; $array2 = [ [ 'date_end' => '2012-01-12', 'result' => 60, 'name' => 'Step#1', 'type' => 'Summary', ] ]; function cmp($a, $b){ $ad = strtotime($a['date']); $bd = strtotime($b['date']); return ($ad-$bd); } $arr = array_merge($array1, $array2); usort($arr, 'cmp'); var_export($arr);
Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0
Warning: Undefined array key "date" in /in/qIp5d on line 33 Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/qIp5d on line 33 Warning: Undefined array key "date" in /in/qIp5d on line 33 Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/qIp5d on line 33 Warning: Undefined array key "date" in /in/qIp5d on line 33 Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/qIp5d on line 33 array ( 0 => array ( 'date_end' => '2012-01-12', 'result' => 60, 'name' => 'Step#1', 'type' => 'Summary', ), 1 => array ( 'date' => '2012-01-10', 'result' => 65, 'name' => 'Les océans', ), 2 => array ( 'date' => '2012-01-11', 'result' => 75, 'name' => 'Les mers', ), 3 => array ( 'date' => '2012-01-13', 'result' => 66, 'name' => 'Les continents', 'type' => 'Scores', ), )
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
98.9 ms | 408 KiB | 5 Q