08 2022 档案

PHP使用递归深度合并多个数组,递归合并嵌套数组
摘要://导入待合并数组,引用$array数组接收 function merge(array &$array,array ...$mergeArray): array { foreach ($mergeArray as $item){ mergeOne($array,$item); //对每个待合并数组执 阅读全文

posted @ 2022-08-02 00:23 DreamOnTheGo 阅读(250) 评论(0) 推荐(0)

php数组通过递归转换成无限级树结构
摘要://id作为索引,pid 为父索引 function tree(&$list,$pid=0){ $tree=[]; foreach ($list as $key=>$item){ if ($item['pid'] $pid){ $tree[$item['id']]=$item; unset($lis 阅读全文

posted @ 2022-08-01 23:48 DreamOnTheGo 阅读(55) 评论(0) 推荐(0)