3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a1 = [ ['v' => '13', 't' => '2015-09-08 18:50:00'], ['v' => '25', 't' => '2015-09-08 19:00:00'], ['v' => '34', 't' => '2015-09-08 19:05:00'], ['v' => '24', 't' => '2015-09-08 19:10:00'] ]; $a2 = [ ['v' => '10', 't' => '2015-09-08 18:50:00'], ['v' => '29', 't' => '2015-09-08 18:55:00'], ['v' => '17', 't' => '2015-09-08 19:00:00'] ]; $result =[]; foreach ($a1 as $row) { $result[$row['t']] = [ 'v1' => $row['v'], 'v2' => null, 't' => $row['t'] ]; } foreach ($a2 as $row) { if (isset($result[$row['t']])) { $result[$row['t']]['v2'] = $row['v']; } else { $result[$row['t']] = [ 'v1' => null, 'v2' => $row['v'], 't' => $row['t'] ]; } } ksort($result); var_export(array_values($result));
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 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
array ( 0 => array ( 'v1' => '13', 'v2' => '10', 't' => '2015-09-08 18:50:00', ), 1 => array ( 'v1' => NULL, 'v2' => '29', 't' => '2015-09-08 18:55:00', ), 2 => array ( 'v1' => '25', 'v2' => '17', 't' => '2015-09-08 19:00:00', ), 3 => array ( 'v1' => '34', 'v2' => NULL, 't' => '2015-09-08 19:05:00', ), 4 => array ( 'v1' => '24', 'v2' => NULL, 't' => '2015-09-08 19:10:00', ), )
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:
139.29 ms | 407 KiB | 5 Q