PHP algorithms: Determining if an IP is within a specific range. « Paul Gregg. I spend a lot of time lurking in the #PHP channel (efnet and freenode, please – no flamewars) and this topic is a commonly asked one that usually gets a simplified answer in the form of using strpos(), or at best an ip2long() in a greater than and less than answer.
Unfortunately although people usually understand that an IP address is simply an unsigned 32 bit integer, and is easily determined, usually with $_SERVER['REMOTE_ADDR'], where the real challenge is – is in specifying the range within which they wish to check that IP address. IP ranges are usually specified in three common ways (in increasing complexity): Wildcard: 192.168.10. Packagist. Composer. PHP 5.3 Namespacing And Autoloading - PHP Tutorials.