Answer the question
In order to leave comments, you need to log in
Why doesn't simplexml return what I need?
There is this XML:
<?xml version="1.0" encoding="utf-8"?>
<rainbowdash>
<response>1</response>
</rainbowdash>
<?xml version="1.0" encoding="utf-8"?>
<response>1</response>
$test = simplexml_load_file("input.txt");
echo $test->response;
Answer the question
In order to leave comments, you need to log in
There is such a good function var_dump. Often leads to useful thoughts.
In the case of this xml, casting to a string is appropriate:
$xml = '<?xml version="1.0" encoding="utf-8"?>
<response>5</response>';
$test = simplexml_load_string($xml);
echo (string) $test;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question