Skip to content

Instantly share code, notes, and snippets.

@mikedugan
Created November 7, 2013 14:55
Show Gist options
  • Save mikedugan/7355925 to your computer and use it in GitHub Desktop.
Save mikedugan/7355925 to your computer and use it in GitHub Desktop.
general purpose xml reader
<?php
//useful in combination with scandir() function and a foreach loop
if (file_exists('test.xml') {
$xml = simplexml_load_file('test.xml');
$node1 = $xml->node1;
$node2 = $xml->node1->node2;
$n2attr = $node2['someAttr'];
}
else { exit('Failed to open file'); }
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment