Home > Backend Development > PHP Tutorial > Usage example of regular replacement function ereg_replace in php_PHP tutorial

Usage example of regular replacement function ereg_replace in php_PHP tutorial

WBOY
Release: 2016-07-13 10:11:24
Original
990 people have browsed it

Usage examples of the regular replacement function ereg_replace in php

The following example is to use the regular replacement function ereg_replace in php to replace the specified characters with the character examples I want. The code is as follows:

The code is as follows:

$num = 'www.jb51.net';
$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/930077.htmlTechArticleUsage examples of the regular replacement function ereg_replace in php. The following example uses the regular replacement function ereg_replace in php to replace the specified characters. Into the character example I want, the code is as follows: Code...
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template