- simplexml_load_string: documentation ( source)
<?php
$source = <<<DATA
<xml>
<title>Test 123</title>
<categories>
<category>Test1</category>
<category>Test2</category>
</categories>
</xml>
DATA;
$item = simplexml_load_string($source);
foreach ($item->categories->category as $elm) {
echo $elm . PHP_EOL;
}