When I used to develope in ASP I had this really nice function that I could pass just about anything to and it would always come back to me as a string with all the escape characters converted to HTML safe. I am tryingo tdo something similar with PHP but I am having a hell of a time with forcing something to be a string because there is no variable declaration.
Here is my old ASP function:
function undefRemove(t)
{
t = new String(Request(t));
t = t.replace(/\\"/g, \""\");
t = t.replace(/>/g, \">\");
t = t.replace(/</g, \"<\");
t = t.replace(/\\'/g, \"`\");
if(t == \"undefined\") t= null;
return t;
}
Can anyone help me to make it a PHP function? Probably something like this but not exactly...
function undefRemove($t)
{
$t = new String(Request($t));
$t = eregi(\"\\"\", \""\");
$t = eregi(\"\>\", \">\");
$t = eregi(\"\<\", \"<\");
$t = eregi(\"\\'\", \"`\");
if($t == \"undefined\") {$t= null;}
return $t;
}