XML::offsetExists()
Checks if an attribute exists.
Table of Contents
Description
XML::offsetExists(mixed $key): bool;
This method is a requirement to be able to implement the ArrayAccess
interface and aims to make the object data accessible using array access syntax. You won’t use this method directly, it will be executed automatically when you try to check the existence of an attribute with array access syntax. This method checks if an attribute exists in the node and will only work when checked using empty()
or isset()
language construct.
Passing a numeric key is considered as checking the data directly from the source. Which means that checking attribute 0
tests the node name, checking attribute 1
tests the node content, checking attribute 2
tests the node attributes.
Example
$node = new XML('<input disabled="disabled" name="test" value=""/>');
test(empty($node['disabled'])); // Returns `false`
test(empty($node['value'])); // Returns `true`
test(isset($node['name'])); // Returns `true`
XML::_()
The dynamic method initiator.
XML::__call()
Proxy for missing methods.
XML::__callStatic()
Proxy for missing static methods.
XML::__construct()
The constructor.
XML::__serialize()
Provides data to be serialized.
XML::__toString()
Converts the XML object to string.
XML::__unserialize()
Converts the serialized data back to its object.
XML::count()
Nothing.
XML::jsonSerialize()
Returns the data to be serialized as JSON.
XML::offsetExists()
Checks if an attribute exists.
XML::offsetGet()
Gets the attribute’s value.
XML::offsetSet()
Sets the attribute’s value.
XML::offsetUnset()
Deletes an attribute.