PHP Program to replace a word in a string using str_ireplace()
<?php
$str = 'sayesha';
// message to be printed
$newstr = 'welcome ' . $str . ' to learn about PHP language. We are delighted to have you ' . $str;
// printing message
echo ($newstr . "\n");
// changing the name
$str1 = 'Sayesha';
echo str_ireplace($str, $str1, $newstr);
?>
Output
welcome sayesha to learn about PHP language. We are delighted to have you sayesha
welcome Sayesha to learn about PHP language. We are delighted to have you Sayesha
