File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ this behaviour you can set the third argument to false. We'll leave all keynames
6363$result = ArrayToXml::convert($array, 'customrootname', false);
6464```
6565
66- You can use a key named ` _attributes ` to add attributes to a node.
66+ You can use a key named ` _attributes ` to add attributes to a node, and ` _value ` to specify the value .
6767
6868``` php
6969$array = [
@@ -76,6 +76,10 @@ $array = [
7676 'name' => 'Sauron',
7777 'weapon' => 'Evil Eye'
7878 ]
79+ 'The survivor' => [
80+ '_attributes' => ['house'=>'Hogwarts'],
81+ '_value' => 'Harry Potter'
82+ ]
7983];
8084
8185$result = ArrayToXml::convert($array);
@@ -94,6 +98,9 @@ This code will result in:
9498 <name >Sauron</name >
9599 <weapon >Evil Eye</weapon >
96100 </Bad_guy >
101+ <The_survivor house =" Hogwarts" >
102+ Harry Potter
103+ </The_survivor >
97104</root >
98105```
99106
You can’t perform that action at this time.
0 commit comments