The example below the php Regular Expression replacement function ereg_replace is to use the php Regular Expression replacement function ereg_replace to replace the specified character with the desired character instance.
Php tutorial Regular Expression replacement function ereg_replace
The following example uses the php Regular Expression replacement function ereg_replace to replace the specified character with the desired character.
*/
$ 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 =========== ";