src/SimpleDOM.php
public function sortedXPath($xpath)
    {
        $nodes = $this->xpath($xpath);
        $args = func_get_args();
        $args[0] =& $nodes;

        call_user_func_array(array(get_class($this), 'sort'), $args);

        return $nodes;
    }
public function sortedXPath($xpath)
    {
        $nodes = $this->xpath($xpath);
        $args = func_get_args();
        $args[0] =& $nodes;

        call_user_func_array(array(get_class($this), 'sort'), $args);

        return $nodes;
    }
Run an XPath query and sort the result

This method accepts any number of arguments in a way similar to {@link
http://docs.php.net/manual/en/function.array-multisort.php array_multisort()}

<code>
// Retrieve all <x/> nodes, sorted by @foo ascending, @bar descending
$root->sortedXPath('//x', '@foo', '@bar', SORT_DESC);

// Same, but sort @foo numerically and @bar as strings
$root->sortedXPath('//x', '@foo', SORT_NUMERIC, '@bar', SORT_STRING, SORT_DESC);
</code>

@param    string $xpath XPath expression
@return    SimpleDOM[]