PHP snippet to match wildcarded IPv4 strings
<p>I'm finding an hard time in figuring out how to create a snippet that can tell me if an ip is matching with a database of blacklisted ips, also containing wildcards.
Example:</p>

<pre><code>$global_blacklistedips = Array ( '10.10.*.*', '192.168.1.*' );

function checkBlacklistedIp ( $ip ) {

    // some kind of regular expression

    // match? return true;
    // else return false;
}
</code></pre>

<p>Anyone can help? The only approach I've figured out is to code a very very ugly "state machine" that switches between 1, 2, or 3 wildcards ( 4 wildcards would lead to blacklist everything ), but this kind of coding is really a mess</p>
