XPath can be used to filter your results according to any values
<? $xml = simplexml_load_file('employees.xml'); $employees = $xml->xpath('/employees/employee[name="Laura Pollard"]'); foreach($employees as $employee) { echo "Found {$employee->name}<br />"; } $employees = $xml->xpath('/employees/employee[age<54]'); foreach($employees as $employee) { echo "Found {$employee->name}<br />"; } $employees = $xml->xpath('//employee[age>=48]'); foreach($employees as $employee) { echo "Found {$employee->name}<br />"; } ?>