Hi Guys.
Could anyone help me decipher this piece of code from my contact page.
What i’m not quit sure about i how this piece of code works [php] return str_replace($bad,"",$string);[/php] As i understand it $bad is going to be replaced by replace in $string. But it dont understand what it does when there is nothing in replace?
Can anyone explain it?
Here is how the codes looks like, in case you need to see it in a context:
[php]
$email_message = “Form details below.\n\n”;
function clean_string($string) {
$bad = array(“content-type”,“bcc:”,“to:”,“cc:”,“href”);
return str_replace($bad,"",$string);
}
$email_message .= "First Name: ".clean_string($first_name)."\n";
$email_message .= "Last Name: ".clean_string($last_name)."\n";
$email_message .= "Email: ".clean_string($email_from)."\n";
$email_message .= "Telephone: ".clean_string($telephone)."\n";
$email_message .= "Comments: ".clean_string($comments)."\n";
[/php]