- var_dump: documentation ( source)
- simplexml_load_string: documentation ( source)
<?php
$s =
'<root>
<Formula>
<formulaname attr="1.0">Basic</formulaname>
<movespeed>1</movespeed>
<box>4</box>
<chicken>3</chicken>
<ducks>1</ducks>
<cereal>2</cereal>
</Formula>
</root>';
$xml = simplexml_load_string($s);
$arr = (array) $xml;
$newArr = (array)$arr['Formula'];
var_dump($newArr['formulaname']);