When called with no paramaters, this returns all objects wrapped by
the DOMQuery. Typically, these are DOMElement objects (unless you have
used map(), xpath(), or other methods that can select
non-elements).
When called with an index, it will return the item in the DOMQuery with
that index number.
Calling this method does not change the DOMQuery (e.g. it is
non-destructive).
You can use qp()->get() to iterate over all elements matched. You can
also iterate over qp() itself (DOMQuery implementations must be Traversable).
In the later case, though, each item
will be wrapped in a DOMQuery object. To learn more about iterating
in QueryPath, see {@link examples/techniques.php}.
public get ( integer $index = null, boolean $asObject = false ) : mixed | ||
$index | integer | If specified, then only this index value will be returned. If this index is out of bounds, a NULL will be returned. |
$asObject | boolean | If this is TRUE, an SplObjectStorage object will be returned instead of an array. This is the preferred method for extensions to use. |
리턴 | mixed | If an index is passed, one element will be returned. If no index is present, an array of all matches will be returned. |