Home > Backend Development > PHP Tutorial > Convert year, month and day data into three-level linkage array

Convert year, month and day data into three-level linkage array

WBOY
Release: 2016-09-21 14:12:58
Original
1223 people have browsed it

The structure of each data is as follows:

<code>{
    id: 2,
    year: "2016",
    month: "09",
    day: "19",
    time_name: "下午班",
    time_range: "14:00-17:00"
},</code>
Copy after login
Copy after login

It needs to be converted into the following linkage effect based on the year, month and day data inside. I haven’t thought of a better loop to make them into a data structure like province and city linkage, because after all, there are 3 dimensions. Is there any better solution?

Convert year, month and day data into three-level linkage array

Reply content:

The structure of each data is as follows:

<code>{
    id: 2,
    year: "2016",
    month: "09",
    day: "19",
    time_name: "下午班",
    time_range: "14:00-17:00"
},</code>
Copy after login
Copy after login

It needs to be converted into the following linkage effect based on the year, month and day data inside. I haven’t thought of a better loop to make them into a data structure like province and city linkage, because after all, there are 3 dimensions. Is there any better solution?

Convert year, month and day data into three-level linkage array

It is too troublesome to use code to filter items one by one. It is recommended to use web sql. You can search for related articles
or you can read this html5 local storage

Related labels:
php
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template