Cara Mendapatkan Data Dari File XML di PHP

//student.xml

<?xml version="1.0"?>
<college>
 <student>
 <firstname>Tom</firstname>
 <lastname>Cruise</lastname>
 <class>12th</class>
 <marks>456</marks>
 </student>
 <student>
 <firstname>Tyler</firstname>
 <lastname>Horne</lastname>
 <class>12th</class>
 <marks>485</marks>
 </student>
</college>
//php code


<?php
$xmldata = simplexml_load_file("student.xml") or die("Failed to load");
foreach($xmldata->children() as $empl) 
{         
 echo $empl->firstname . ", ";     
 echo $empl->lastname . ", ";     
 echo $empl->class . ", ";        
 echo $empl->marks . "<\n>"; 
} 
?>
Chandan