I have a array of page numbers:
foreach($elements as $el) {
$pageno = $el->getAttribute("pageno");
echo $pageno ;
}
Sadly it contains duplicates. I tried the follow code but it won't return a thing:
foreach(array_unique($elements) as $el) {
$pageno = $el->getAttribute("pageno");
echo $pageno ;
}
How to remove the duplicate page numbers? Thanks in advance :)
$elements
is not an array?getAttribute
sounds like domdocument object maybe? – chris85 Oct 2 '17 at 12:40array_unique()
? – GrumpyCrouton Oct 2 '17 at 13:06getAttribute
inside his loop, so array_unique can't work here imo – Frankich Oct 2 '17 at 13:14