当前位置:网站首页>PHP recursive multi-level classification, infinite classification
PHP recursive multi-level classification, infinite classification
2022-06-30 14:19:00 【Meimei Technology】
function getChild($data, $id = 0)
{
// Initialize son
$child = [];
// Cycle all data to find $id Son
foreach ($data as $key => $datum) {
// I found my son
if ($datum['pid'] == $id) {
// preserved , Then continue to find his son's son
$child[$datum['id']] = $datum;
// Get rid of yourself first , You can't be your own grandchildren
unset($data[$key]);
// Recursively look for , And put the found son in a child In the field of
$child[$datum['id']]['child'] = $this->getChild($data, $datum['id']);
}
}
return $child;
}From the Internet, thanks for sharing . Keep it for future use
边栏推荐
- Observable, seulement fiable: première bombe de salon de la série cloudops d'exploitation et d'entretien automatisés dans le nuage
- QQ 居然被盗了?原因在这......
- Meaning of while (~scanf ("%d%d", & A, & B))
- Fastcgi CGI shallow understanding
- 【Redis 系列】redis 学习十六,redis 字典(map) 及其核心编码结构
- 想請教一下,我在佛山,到哪裏開戶比較好?手機開戶是安全麼?
- When SQL queries are performed in table storage, an error is reported when the primary key is added to the query result, and the query result exceeds 10W rows. Do you want to add multiple indexes to t
- remote: Support for password authentication was removed on August 13, 2021. Please use a personal ac
- Go language func function
- “即服务”,企业数字化转型的必然选择
猜你喜欢

Getting started with shell Basics
![[scientific research data processing] [practice] frequency analysis chart of category variables, distribution chart of numerical variables and normality test (including lognormal)](/img/5a/eaa845f4332f0b8ee8b6409d6a79e8.png)
[scientific research data processing] [practice] frequency analysis chart of category variables, distribution chart of numerical variables and normality test (including lognormal)

Solve the error in my QT_ thread_ global_ End(): 3 threads didn't exit

Mysql database foundation: stored procedures and functions

MFQE 2.0: A New Approach for Multi-FrameQuality Enhancement on Compressed Video

The programming competition is coming! B station surrounding, senior members and other good gifts to you!

Laravel configures passport and returns token using JWT

SQL attendance statistics monthly report

MySQL access denied, opened as Administrator

Pytoch viewing model parameter quantity and calculation quantity
随机推荐
IM即时通讯应用开发中无法解决的“顽疾”
提权扫描工具
Pytorch查看模型参数量和计算量
Configuration of headquarters dual computer hot standby and branch infrastructure for firewall Foundation
Three uses of golang underscores
MFQE 2.0: A New Approach for Multi-FrameQuality Enhancement on Compressed Video
深入理解.Net中的线程同步之构造模式(二)内核模式2.内核模式构造物Semaphone
用Unity实现Flat Shading
步骤详解 | 助您轻松提交 Google Play 数据安全表单
This article explains the concepts of typed array, arraybuffer, typedarray, DataView, etc
Tencent two sides: @bean and @component are used on the same class. What happens?
半导体动态杂谈
On simple code crawling Youdao translation_ 0's problem (to be solved)
[observation] as the intelligent industry accelerates, why should AI computing power take the lead?
【科研数据处理】[实践]类别变量频数分析图表、数值变量分布图表与正态性检验(包含对数正态)
Attack and defense world web questions
Observable, reliable: the first shot of cloudops series Salon of cloud automation operation and maintenance
【观察】智能产业加速,为何AI算力要先行?
數據恢複軟件EasyRecovery15下載
【 scientific literature measurement 】 mining and visualization of keywords in foreign and Chinese Literature