0

I have a PHP variable which have xml content inside. If I echo the variable it is printing 1. Why it is happening like this?

$xml =  "<?xml version='1.0'?><Item><qoh>".$quantity_to_update."</qoh></Item>";

echo $xml;

OUTPUT

1

1
  • Doesn't really look like XML that's inside your variable. That is a simple string. Commented Oct 5, 2015 at 10:43

2 Answers 2

2

It is printing 1 because you are using your tags between < and >. So, it is not showing in your html page. But may be present in the source of the HTML. Try this

echo htmlspecialchars($xml);
Sign up to request clarification or add additional context in comments.

Comments

0

Your variable "$quantity_to_update" will have a value (I think it is 1). Please check your variable output.

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.