I have an array of root domains (eg google.com, somedomain.com, but not subdomain.domain.com) and i want to check if an arbitrary domain has the same root domain. The arbitrary domain could be subdomain.domain.com and it would match with domain.com.
Previously I just filtered a list of input domains using array_udiff and a custom comparator function I wrote. I just switched to a method where each input domain has to be checked individually, I can't just check against a whole array.
Rather than do array_udiff with an array of size 1 and check to see if its size isn't 0 afterwards, or loop through the array and call the function manually, I was hoping that there was a function that already does this. PHP has an in_array function but it doesn't allow a custom comparator. Does such a function exist?