orOr you could use the XmlXML class from below repositorythis repository, along with Xpath selectors https://github.com/mekanixms/xms
, and the code would be something like:
<?php
$f = file_get_contents("timber.xml");
$xml = new Xms\Core\Xml($f);
$order_number_val = $xml("//order-number")->text();
$xml("//shipping-address")->children("*[last()]")->to($shipping_address);
...