I am having trouble using a function for replacing text in my string, here is the function:
function decodeString($string){
$foo = "foo1";
$string = str_replace("foo",$foo,$string);
return $string;
}
I am accessing it from another page and the PHP file the function is in, is included before I try to use it.
decodeString($var1);
When it returns, the replacement is empty, so it just removed the word "foo", whereas if I don't use a variable in the replace function ($foo), and instead enter the text as a string there so "foo", then it returns with the text there, why can't it be returned if it's a variable?!! Don't understand this :(