Skip to content

Generating empty tags in another way #202

Answered by weirdan
uncrackable404 asked this question in Q&A
Discussion options

You must be logged in to vote

Passing an empty array for that element should do the trick:

(new Spatie\ArrayToXml\ArrayToXml([
     'valore1' => 'ciao',
     'valore2' => [], // <===============
]))->prettify()->toXml();

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@uncrackable404
Comment options

Answer selected by uncrackable404
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants