I am stuck into a strange problem. I am running php5 on apache. and the problem is that str_replace command is not working $name="mike stemle"; str_replace("mike","kite",$name); echo $name. Output should be 'kite stemle' but strange, for me the output is still "mike stemle" Am i making some mistake??
$name = str_replace("mike","kite",$name); PHP: str_replace() returns the new value and you have to assign it to a variable.
This will solve your problem: $name="mike stemle"; $name=str_replace("mike","kite",$name); echo $name.
oh my goodness!! I am so stupid.. Thanks nico_swd and yiam. Green your way Sorry nico system is not allowing me to give you green. As i gave u green 2-3 days before also. Anyway thanks man
Hi, the funny thing is I did not make the above mistake and yet, str_replace is not working: $pt_old = $this->text('title'); $pt_new=str_replace("a", " ", $pt_old);