As I told in comments, get the pin of each record, compare it to the exclude array, if it is part of the exclude array then just continue the loop. Like this:
$url = 'http://www.inveroak.com/readerimages/livepanel/91221.xml';
$xml = simplexml_load_file($url);
$items = array();
$exclude = array('4419','4373');
$items = array_diff($items, $exclude);
foreach($xml as $Reader) {
$items[] = $Reader;
}
usort ($items, function($a, $b) {
return strcmp($a->Status,$b->Status);
});
foreach($xml as $Reader) {
if($Reader->Status != 'Logged Off'
&& $Reader->Picture != 'None'
// check if the Pin is in exclude array
&& !in_array($Reader->Pin, $exclude)
) {
include '/extras/reader-single.php';
}
}
Alternatively you may use array_filter()
:
$url = 'http://www.inveroak.com/readerimages/livepanel/91221.xml';
$xml = simplexml_load_file($url);
$items = array();
$exclude = array('4419','4373');
$items = array_diff($items, $exclude);
foreach($xml as $Reader) {
$items[] = $Reader;
}
$items= array_filter($items, function($Reader) use ($exclude) {
if($Reader->Status == 'Logged Off'
|| $Reader->Picture == 'None'
|| in_array($Reader->Pin, $exclude)
) {
return false;
}
return true;
});
usort ($items, function($a, $b) {
return strcmp($a->Status,$b->Status);
});
foreach($items as $Reader) {
include '/extras/reader-single.php';
}