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));

preferences:
40.19 ms | 402 KiB | 5 Q