Read XML File

PHP Programming

PHP Programming Examples

<?php
	/*  Interprets an XML file into an object */
	$xml = simplexml_load_file('customers.xml');
	
	/* Runs XPath query on XML data */
	foreach($xml->xpath("customer") as $customer) {
		
		/* Print XML data */
		echo "Customer Name: ".$customer->name."<br />";
		echo "Customer Name: ".$customer->email."<br />";
		echo "Customer Name: ".$customer->requirement."<br /><br />";
	}
?>


          /****** Output ******/
          

Customer Name: James


Customer Name: [email protected]


Customer Name: Website




Customer Name: Jonny


Customer Name: [email protected]


Customer Name: Android App

Learn more about imagedestroy