-2

In PHP programming can we use str_replace(); in echo '';
If it is possible then please show me an example.

4
  • 1
    echo str_replace(' World','','Hello World'); ??
    – Giona
    Sep 18, 2012 at 17:44
  • 1
    -1 at least try it first, or tell us what you have tried and why you can't get it to work.
    – Stu
    Sep 18, 2012 at 17:45
  • omg! okay, assuming a echo has a out like this> echo 'I think people here are so $say'; then how, in this case, str_replace(); can be use Sep 18, 2012 at 17:52
  • echo 'I think people here are so '.str_replace('cool', 'mean', $say);
    – Stu
    Sep 18, 2012 at 18:02

1 Answer 1

4
echo str_replace('dog', 'cat', 'thats an ugly dog');

output is "thats an ugly cat" from "thats an ugly dog";

Example: http://codepad.org/b63nu4Ie

Not the answer you're looking for? Browse other questions tagged or ask your own question.