Realization method of recursive sorting of php infinitesimal classification

  • 2021-07-26 07:05:25
  • OfStack

This paper describes the implementation method of recursive sorting of php infinite pole classification with examples. Share it for your reference. The specific implementation method is as follows:

function order ($array,$pid=0){
    $arr = array();
       
    foreach($array as $v){
        if($v['pid']==$pid){
            $arr[] = $v;
            $arr = array_merge($arr,order($array,$v['id']));
        }
    }
    return $arr;
}

I hope this article is helpful to everyone's PHP programming.


Related articles: