I have a Pages Object. For each page in the Pages Object I would like to check the field object of its source: URL field. If the URL is the same I would like to remove it or skip it in a foreach loop.
I have not included any code, because I am stuck at the beginning. I understand something like array_unique could help me.
<?php
$urls = [];
foreach ($pages as $page) {
if (in_array($page->source(), $urls)) {
continue;
}
$urls[] = $page->source();
// do something here for all relevant pages
}