How to display a string after replacing the specific character in the string with a character of our own choice? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to display a string after replacing the specific character in the string with a character of our own choice?

for ex pharaoh -> phorooh replaced all a with o

5th Aug 2018, 6:51 PM
Lord Pharaoh
Lord Pharaoh - avatar
1 Answer
+ 1
var str = "pharaoh"; str = str.replace(/a/g, "o"); echo str_replace("a","o","pharaoh");
5th Aug 2018, 7:33 PM
Toni Isotalo
Toni Isotalo - avatar