3v4l.org

run code in 300+ PHP versions simultaneously
<?php $format = function($map){ $formated = array(); foreach($map as $day => $reg){ $formated[$day][$reg['HORA']] = $reg; } return $formated; }; $result = array_map(array_merge_recursive( array( '2015-01-01' => array(array('HORA' => '0600', 'MOTIVO' => 'teste')), '2015-01-02' => array(array('HORA' => '0600', 'MOTIVO' => 'teste'),array('HORA' => '0700', 'MOTIVO' => 'teste')), '2015-01-03' => array(array('HORA' => '0600', 'MOTIVO' => 'demo')) ), array( '2015-01-01' => array(array('HORA' => '0600', 'MOTIVO' => 'teste')), '2015-01-02' => array(array('HORA' => '0800', 'MOTIVO' => 'teste')), '2015-01-03' => array(array('HORA' => '0800', 'MOTIVO' => 'demo')) ) )); print_r($result);
Output for 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Fatal error: Uncaught ArgumentCountError: array_map() expects at least 2 arguments, 1 given in /in/PYc10:9 Stack trace: #0 /in/PYc10(9): array_map(Array) #1 {main} thrown in /in/PYc10 on line 9
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Fatal error: Uncaught ArgumentCountError: array_map() expects at least 2 arguments, 1 given in /in/PYc10:9 Stack trace: #0 /in/PYc10(9): array_map(Array) #1 {main} thrown in /in/PYc10 on line 9
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27
Fatal error: Uncaught ArgumentCountError: array_map() expects at least 2 arguments, 1 given in /in/PYc10:16 Stack trace: #0 /in/PYc10(16): array_map(Array) #1 {main} thrown in /in/PYc10 on line 16
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
Warning: array_map() expects at least 2 parameters, 1 given in /in/PYc10 on line 16
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Warning: array_map() expects at least 2 parameters, 1 given in /in/PYc10 on line 20

preferences:
164.26 ms | 401 KiB | 182 Q