File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -112,4 +112,25 @@ You can unset nested key.
112112 var_dump($array['foo']); // => array(0) {}
113113```
114114
115- After nested manipulations you might want to get back the ** real array** . This can be done by calling ` $array->toArray() ` .
115+ After nested manipulations you might want to get back the ** real array** . This can be done by calling ` $array->toArray() ` .
116+
117+ ## XPath Key Array
118+
119+ ** This is not a real xpath!** This class instead of array-like key users string of keys delimited with ` / ` .
120+
121+ ``` php
122+ $array = new XPathKeyArray([
123+ 'foo' => [
124+ 'bar' => 'baz'
125+ ]
126+ ]);
127+
128+ var_dump($array['foo/bar']); // => string(3) "baz"
129+ ```
130+
131+ This one was inspired by [ an old article] ( http://codeaid.net/php/get-values-of-multi-dimensional-arrays-using-xpath-notation ) .
132+
133+ Compared to ` CompositeKeyArray ` , ` XPathKeyArray ` has some limitations:
134+
135+ 1 . You cannot use keys with ` / ` in them.
136+ 2 . You cannot use ` null ` as key.
You can’t perform that action at this time.
0 commit comments