0 =>
array =>
'orderno' => '150228085016'
'delivery_time' => '1425124096'
'create_time' => '1425174370'
1 =>
array =>
'orderno' => '150228084786'
'delivery_time' => '1425124096'
'create_time' => '1425174374'
2 =>
array =>
'orderno' => '150228090539'
'delivery_time' => '1425123584'
'create_time' => '1425174387'
数组如上,我想使用对每组数组中的delivery_time 和 create_time键使用Date函数,得出结果如下:
0 =>
array =>
'orderno' => '150228085016'
'delivery_time' => '2015-03-11'
'create_time' => '2015-03-11'
1 =>
array =>
'orderno' => '150228084786'
'delivery_time' => '2015-03-11'
'create_time' => '2015-03-11'
2 =>
array =>
'orderno' => '150228090539'
'delivery_time' => '2015-03-11'
'create_time' => '2015-03-11'
除了循环之外,PHP数组有没有内置的方法?
PHP中文网2017-04-10 15:27:36
$arr = array_map(function ($n) {
return date('Y-m-d', $n);
}, array_column($arr, 'create_time'));
ringa_lee2017-04-10 15:27:36
假设你上面那个数组叫 $a...
function mydate($t)
{
return date("Y/m/d",$t);
}
$ct = array_map("mydate",array_column($a,'create_time'));
print_r($ct);