0

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>

1 Answer 1

3

Create array in this way:

['foo' => ['@tag' => 'bar', '#' => 'baz']]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.