Home > Backend Development > PHP Tutorial > php如何遍历出24个小时

php如何遍历出24个小时

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:09:07
Original
1435 people have browsed it

php如何遍历出24个小时

我要添加23个小时的数据 如何用php添加 其他时间的 默认为0 如果
【10:00】=》array
(
[time]=>10
['good_amout']=>3
)

回复内容:

php如何遍历出24个小时

我要添加23个小时的数据 如何用php添加 其他时间的 默认为0 如果
【10:00】=》array
(
[time]=>10
['good_amout']=>3
)

$Time_arr = [];
for($i=0;$i<24;$i++)
{
    $key = date($i.':00');
    $Time_arr[$key] = [
        'time' => $key,
        'good_amout' => 0
    ];
}
Copy after login

Related labels:
php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template