Home > php教程 > php手册 > body text

php 正则替换函数 ereg_replace

WBOY
Release: 2016-06-13 11:17:46
Original
1138 people have browsed it

php 正则替换函数 ereg_replace下面的实例是利用php 正则替换函数 ereg_replace来把指定的字符替换成我想需要的字符实例。  

php教程 正则替换函数 ereg_replace
下面的实例是利用php 正则替换函数 ereg_replace来把指定的字符替换成我想需要的字符实例。
*/
    

$num = 'www.bkjia.com';
     $string = "this string has four words.
";
     $string = ereg_replace ('four', $num, $string);
     echo $string;
 
     $num = '49';
     $string = "this string has four words";
     $string = ereg_replace ('four', $num, $string);
     echo $string;
 
 
   $string ="测试用文字";
   echo "**********$string**********

";
   $string = ereg_replace ("^", "
", $string);
   $string = ereg_replace ("$", "
", $string);
   echo "==========$string==========";


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!