Hello Firends Today I will tell you how to replace a word inside a string using PHP. So let’s Start.
str_replace():- Through this function, you can remove a word from a string and show that string. As an argument, in this function you pass string variable or constant string and the word that you want to remove from string. This is explained by the following example.
Keywords:- How to Replace a Word inside a String in PHP, How do I Replace Part of a String in PHP, Replacing Text in PHP Strings, PHP str_replace() Function
Replace a Text in a String With Another Text in PHP With Example
<?php // Input string $Value = "I am going to Delhi.I am Experts PHP Developer."; // using str_replace() function $Strval = str_replace('Delhi', 'Noida', $Value); print_r($Strval); ?>