当前位置:网站首页>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
边栏推荐
- 我想问一下招商证券怎么开户?通过链接办理股票开户安全吗
- More than 20 years after Hong Kong's return, Tupu digital twin Hong Kong Zhuhai Macao Bridge has shocked
- 单元测试效率优化:为什么要对程序进行测试?测试有什么好处?
- Unity animator parameter
- [redis series] redis learning 16. Redis Dictionary (map) and its core coding structure
- PHP 2D array change key name
- 深入理解.Net中的线程同步之构造模式(二)内核模式3.内核模式构造物Mutex
- Solve the error in my QT_ thread_ global_ End(): 3 threads didn't exit
- 【刷题篇】爱吃香蕉的珂珂
- ot initialized – call ‘refresh’ before invoking lifecycle methods via the context: Root WebApplicati
猜你喜欢

Step by step | help you easily submit Google play data security form

Rpm2rpm packaging steps

Optimization of unit test efficiency: why test programs? What are the benefits of testing?

Heavyweight: the domestic ide was released, developed by Alibaba, and is completely open source!

智慧运维:基于 BIM 技术的可视化管理系统

可觀測,才可靠:雲上自動化運維CloudOps系列沙龍 第一彈

步骤详解 | 助您轻松提交 Google Play 数据安全表单

【科学文献计量】外文文献及中文文献关键词的挖掘与可视化
![[Title brushing] heater](/img/ee/70e122b1b1a406624aa7c6442fcdc1.png)
[Title brushing] heater
![【科研数据处理】[实践]类别变量频数分析图表、数值变量分布图表与正态性检验(包含对数正态)](/img/5a/eaa845f4332f0b8ee8b6409d6a79e8.png)
【科研数据处理】[实践]类别变量频数分析图表、数值变量分布图表与正态性检验(包含对数正态)
随机推荐
[Title brushing] coco, who likes bananas
[redis series] redis learning 16. Redis Dictionary (map) and its core coding structure
MySQL access denied, opened as Administrator
Realize a simple LAN communication (similar to feiqiu)
Go sync. WaitGroup
【科学文献计量】外文文献及中文文献关键词的挖掘与可视化
Embedded development: five C features that may no longer be prohibited
Deep understanding Net (2) kernel mode 2 Kernel mode construct semaphone
Mutex lock, read / write lock, spin lock, pessimistic lock, and optimistic lock
XSS challenge (1-5) more detailed answers
Numpy creates an empty array data = np empty(shape=[1, 64,64,3])
可观测,才可靠:云上自动化运维CloudOps系列沙龙 第一弹
Shell programming overview
Pytorch查看模型参数量和计算量
Summary of FTP network protocol learning
Je suis à Foshan, où puis - je ouvrir un compte? L'ouverture d'un compte par téléphone mobile est - elle sécurisée?
Unity animator parameter
Crypto questions
數據恢複軟件EasyRecovery15下載
The JSON data returned from the control layer to JS has a "\" translator. How to remove it