Home > Article > Backend Development > PHP regular replacement function ereg_replace_PHP tutorial
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==========";