Block IP Range using Wildcard with PHP

// array's of banned IP addresses
$bannedIP = array("^10.999.00.*", "^99.88.77.*", "192.168.0.1", "^66.77.*.*");
if(in_array($_SERVER['REMOTE_ADDR'],$bannedIP)) {
// this is for exact matches of IP address in array
header("Location: http://www.domain.com");
exit();
} else {
// this is for wild card matches
foreach($bannedIP as $ip) {
if(eregi($ip,$_SERVER['REMOTE_ADDR'])) {
header("Location: http://www.domain.com");
exit();
}
}
}