Source Code:
(back to article)
<?php // PHP program to replace // a word inside a string // Given string $str = "w3docs is W3docs"; // Word to be replaced $w1 = "w3docs"; // Replaced by $w2 = "W3DOCS"; // Using str_ireplace() function // replacing the word $str = str_ireplace($w1, $w2, $str); // Printing the result echo $str; ?>
Result:
Report an issue