PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am wondering whether there is a PHP function like in_array, but implemented in "array_walk" manner - i.e. by using custom compare function ... Couldn't find a one in PHP documentations.
If such exists then it would be better to have a sorted array of possible referers and make a binary search on it.
There are 10 types of people in this world, those who understand binary and those who don't
That's not exactly what I'm looking for ... it will iterate through the whole array, even worse - it will do it linearly.
EDIT: On second thought, I don't need it in this case ... One could sort the array of possible referrers, extract the referral domain from $_SERVER['HTTP_REFERER'] by using regexp and perform binary search - I think it will be much faster. If there are too many referrers (e.g. > 10^6) one could use hashing algorithms to perform the search...
There are 10 types of people in this world, those who understand binary and those who don't