3 ms·
What do you mean by that? At the very least, most PHP devs know that strpos/strstr are much, much faster than a regular expression.
by erlanger 18y ago
What do you mean by that? At the very least, most PHP devs know that strpos/strstr are much, much faster than a regular expression.
- cakeface 18y agoUnless page load times are affecting your browsing experience, why bother optimizing when a regular expression is so clear and simple.
- erlanger 18y agoYou know what, you're right. I was thinking of something like: if (strpos('http://digg.com/', $_SERVER['HTTP_REFERER'])) header('Location: whateverPage'); But that would block all traffic from Digg, including links in comments, etc. To perform the same check as the regex would require much more code. However, I stand by my Apache recommendation as the best option.