File tree 1 file changed +8
-1
lines changed
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
63
63
$result = ArrayToXml::convert($array, 'customrootname', false);
64
64
```
65
65
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 .
67
67
68
68
``` php
69
69
$array = [
@@ -76,6 +76,10 @@ $array = [
76
76
'name' => 'Sauron',
77
77
'weapon' => 'Evil Eye'
78
78
]
79
+ 'The survivor' => [
80
+ '_attributes' => ['house'=>'Hogwarts'],
81
+ '_value' => 'Harry Potter'
82
+ ]
79
83
];
80
84
81
85
$result = ArrayToXml::convert($array);
@@ -94,6 +98,9 @@ This code will result in:
94
98
<name >Sauron</name >
95
99
<weapon >Evil Eye</weapon >
96
100
</Bad_guy >
101
+ <The_survivor house =" Hogwarts" >
102
+ Harry Potter
103
+ </The_survivor >
97
104
</root >
98
105
```
99
106
You can’t perform that action at this time.
0 commit comments