- Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
- 1 Success 2 Success 3 Success 4 Success
<?php
$ans = <<<XML
<?xml version="1.0" encoding="utf-8"?>
<ResponseDoc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<response>
<index>1</index>
<statusCode>Success</statusCode>
</response>
<response>
<index>2</index>
<statusCode>Success</statusCode>
</response>
<response>
<index>3</index>
<statusCode>Success</statusCode>
</response>
<response>
<index>4</index>
<statusCode>Success</statusCode>
</response>
</ResponseDoc>
XML;
$r1 = simplexml_load_string($ans);
$responses = $r1->xpath('//response');
foreach ($responses as $item) {
echo $item->index, PHP_EOL;
echo $item->statusCode, PHP_EOL;
}