I am trying to replace the string by following code
$find2 = array ('/is/', '/working/');
$replace2 = array ('to', 'work');
$data="During the day, Damien is working";
echo preg_replace ($find2, $replace2, $data);
output is
During the day, Damien to work
but i want the result to be
Damien to work
Code:
Output:
would work. It will remove “Anything, String” to “String”.Removing everything before “,” along with “,”.
For your code, You want the data array to replace the two things + you want a replacement as well along with it as i understand.
So,
Code:
Output: