$xml = simplexml_load_file('employees.xml');
$names = $xml->xpath('/employees/employee/name');
foreach($names as $name) {
echo "Found $name
";
}
echo "
";
$employees = $xml->xpath('/employees/employee');
foreach($employees as $employee) {
echo "Found {$employee->name}
";
}
$names = $xml->xpath('//name');
foreach($names as $name) {
echo "Found $name
";
}
?>