Skip to content

Commit 1a6b9cc

Browse files
lintabafreekmurze
authored andcommitted
Adding _value to readme / docs (spatie#90)
This is a working feature, without documentation.
1 parent c7dc15c commit 1a6b9cc

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: README.md

+8-1
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)