2008年4月28日星期一

将IP最后一位替换为星号

$str = '1.1.1.1';

$reg = '/((?:\d+\.){3})\d+/';

echo preg_replace($reg, "\\1*", $str);
?>

没有评论: