public function order($fields)
    {
        $data = $this->get();

        // prepare arguments for array_multisort()
        $args = [];
        foreach ($fields as list($field, $desc)) {
            $args[] = array_column($data, $field);
            $args[] = $desc ? SORT_DESC : SORT_ASC;
            //$args[] = SORT_STRING; // SORT_STRING | SORT_NUMERIC | SORT_REGULAR
        }
        $args[] = &$data;

        // call sorting
        call_user_func_array('array_multisort', $args);

        // put data back in generator
        $this->generator = new \ArrayIterator(array_pop($args));

        return $this;
    }
public function order($fields)
    {
        $data = $this->get();

        // prepare arguments for array_multisort()
        $args = [];
        foreach ($fields as list($field, $desc)) {
            $args[] = array_column($data, $field);
            $args[] = $desc ? SORT_DESC : SORT_ASC;
            //$args[] = SORT_STRING; // SORT_STRING | SORT_NUMERIC | SORT_REGULAR
        }
        $args[] = &$data;

        // call sorting
        call_user_func_array('array_multisort', $args);

        // put data back in generator
        $this->generator = new \ArrayIterator(array_pop($args));

        return $this;
    }
public function order ( $ fields ) { $ data = $ this -> get ( ) ; // prepare arguments for array_multisort() $ args = [ ] ; foreach ( $ fields as list ( $ field , $ desc ) ) { $ args [ ] = array_column ( $ data , $ field ) ; $ args [ ] = $ desc ? SORT_DESC : SORT_ASC ; //$args[] = SORT_STRING; // SORT_STRING | SORT_NUMERIC | SORT_REGULAR } $ args [ ] = & $ data ; // call sorting call_user_func_array ( 'array_multisort' , $ args ) ; // put data back in generator $ this -> generator = new \ ArrayIterator ( array_pop ( $ args ) ) ; return $ this ; }
Applies sorting on Iterator.

@param array $fields

@return $this
Applies sorting on Iterator .