Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange text when converting XML array to XML

Tags:

php

Im using the answer to this question to convert an array of XML to a single XML output:

Output array of XML to plain XML

Im using the simpler solution of the two there (Marked as the answer)

It all works for me, however at the start of the output I get:

string(109960) "

Can anyone shed any light on this?

like image 377
CLiown Avatar asked Feb 02 '26 04:02

CLiown


1 Answers

This looks like you are using var_dump to output your XML string :

var_dump($xml);

Instead of just using echo :

echo $xml;


It would explain :

  • The quotes arround the whole XML string
  • The string -- which is the type of the variable passed as a parameter to var_dump
  • The 109960 -- which is the length of your string.

var_dump() is useful ; but should only be used when you are debugging, as it outputs more (debugging) informations than just the content of the variable.

like image 147
Pascal MARTIN Avatar answered Feb 03 '26 20:02

Pascal MARTIN



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!