
创新互联,为您提供成都网站建设、成都网站制作、网站营销推广、网站开发设计,对服务柴油发电机等多个行业拥有丰富的网站建设及推广经验。创新互联网站建设公司成立于2013年,提供专业网站制作报价服务,我们深知市场的竞争激烈,认真对待每位客户,为客户提供赏心悦目的作品。 与客户共同发展进步,是我们永远的责任!
关于 preg_filter() 的工作原理和参数说明请参考 preg_replace() 函数。
preg_filter() 函数的使用示例如下:
";
$arr1 = array(
'http://c.biancheng.net/php/',
'http://c.biancheng.net/java/',
'http://c.biancheng.net/python/',
'http://www.google.com/cn/',
'http://cn.bing.com/',
);
$pattern = array('/c\./','/biancheng/');
$replacement = array('www.','baidu');
print_r( preg_replace($pattern, $replacement, $arr1) );
print_r( preg_filter($pattern, $replacement, $arr1) );
?>
执行以上程序的结果如下:
Array
(
[0] => http://www.baidu.net/php/
[1] => http://www.baidu.net/java/
[2] => http://www.baidu.net/python/
[3] => http://www.google.com/cn/
[4] => http://cn.bing.com/
)
Array
(
[0] => http://www.baidu.net/php/
[1] => http://www.baidu.net/java/
[2] => http://www.baidu.net/python/
)