private function recursiveSort(&$tree)
    {
        //execute sort
        usort(
            $tree,
            function ($a, $b) {
                if ($a[$this->config['sort_key']] == $b[$this->config['sort_key']]) {
                    return 0;
                }

                return ($a[$this->config['sort_key']] < $b[$this->config['sort_key']]) ? -1 : 1;
            }
        );

        foreach ($tree as &$t) {
            if (array_key_exists($this->config['childs'], $t) && $t[$this->config['childs']] != '') {
                $t[$this->config['childs']] = $this->recursiveSort($t[$this->config['childs']]);
            }
        }

        return $tree;
    }
private function recursiveSort(&$tree)
    {
        //execute sort
        usort(
            $tree,
            function ($a, $b) {
                if ($a[$this->config['sort_key']] == $b[$this->config['sort_key']]) {
                    return 0;
                }

                return ($a[$this->config['sort_key']] < $b[$this->config['sort_key']]) ? -1 : 1;
            }
        );

        foreach ($tree as &$t) {
            if (array_key_exists($this->config['childs'], $t) && $t[$this->config['childs']] != '') {
                $t[$this->config['childs']] = $this->recursiveSort($t[$this->config['childs']]);
            }
        }

        return $tree;
    }
private function recursiveSort ( & $ tree ) { //execute sort usort ( $ tree , function ( $ a , $ b ) { if ( $ a [ $ this -> config [ 'sort_key' ] ] == $ b [ $ this -> config [ 'sort_key' ] ] ) { return 0 ; } return ( $ a [ $ this -> config [ 'sort_key' ] ] < $ b [ $ this -> config [ 'sort_key' ] ] ) ? - 1 : 1 ; } ) ; foreach ( $ tree as & $ t ) { if ( array_key_exists ( $ this -> config [ 'childs' ] , $ t ) && $ t [ $ this -> config [ 'childs' ] ] != '' ) { $ t [ $ this -> config [ 'childs' ] ] = $ this -> recursiveSort ( $ t [ $ this -> config [ 'childs' ] ] ) ; } } return $ tree ; }
Internal recursive function
@param  array $tree
@return bool
Internal recursive function