Reputation: 2292
I trying to serialize an array with symfony's serialize component. I follow this manual
How to create following xml document:
<foo tag="bar">baz</foo>
My array to serialize:
['foo' => [@tag => 'bar', 'baz']]
but it creates folowing:
<foo tag="bar">
<item key="0">baz</item>
</foo>
Upvotes: 0
Views: 349
Reputation: 440
Create array in this way:
['foo' => ['@tag' => 'bar', '#' => 'baz']]
Upvotes: 3