3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array ( 0 => '2014-06-01 12:45:02' ,1 => '2014-06-01 12:45:03' ,2 => '2014-06-01 12:48:52' ,3 => '2014-06-01 12:50:31' ,4 => '2014-06-01 13:18:49' ,10 => '2014-06-01 13:33:16' ,11 => '2014-06-01 14:20:48' ,12 => '2014-06-01 14:24:44' ,13 => '2014-06-01 15:28:16' ,14 => '2014-06-02 10:50:56' ,15 => '2014-06-02 10:51:07' ,16 => '2014-06-02 18:16:13' ,17 => '2014-06-03 11:20:20' ,18 => '2014-06-03 11:58:46' ,19 => '2014-06-03 11:59:03' ,20 => '2014-06-03 12:00:51' ,21 => '2014-06-03 12:01:21' ,22 => '2014-06-04 19:03:17' ,23 => '2014-06-04 19:06:03' ,24 => '2014-06-04 19:12:03' ,25 => '2014-06-04 21:18:03' ); $start = microtime(true); $new_array = array_map(function($x){return date('Y-m-d', strtotime($x));}, $array); $end = microtime(true); echo $end - $start . "\n"; $start = microtime(true); $new_array = array(); foreach{$array as $arr} { $new_array[] = date('Y-m-d', strtotime($arr)); } $end = microtime(true); echo $end - $start . "\n"; //print_r(array_count_values($new_array));
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.31
Parse error: syntax error, unexpected '{', expecting '(' in /in/R22VE on line 34
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/R22VE on line 28
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION, expecting ')' in /in/R22VE on line 28
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/R22VE on line 28
Process exited with code 255.

preferences:
188.62 ms | 1395 KiB | 121 Q