Home  >  Article  >  Backend Development  >  PHP regular replacement function ereg_replace_PHP tutorial

PHP regular replacement function ereg_replace_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:01:33931browse

PHP regular replacement function ereg_replace The following example uses PHP regular replacement function ereg_replace to replace the specified characters with the character instances I want. ​

php tutorial regular replacement function ereg_replace
The following example uses the PHP regular replacement function ereg_replace to replace the specified characters with the character instances I want.
*/
 

$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 ="Test text";
echo "************$string**********

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


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445434.htmlTechArticlephp regular replacement function ereg_replace The following example uses the php regular replacement function ereg_replace to replace the specified characters with what I want Required character instance. PHP tutorial regular replacement function...
Statement:
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