Will this work?
Posted: Mon Feb 20, 2006 4:52 pm
Hey guys... I am testing out a function I just wrote and it seems to be working fine, but I wanted to show it to you guys to make sure I don't have any flaws or that I am overlooking something.
Since I have to output a lot of variables to the client in php, I always have to constantly type:
But I don't want to have to write out the whole 'stripslashes....entites..ENT_QUO's, etc'... so I made a function to do it for me:
Thus all I have to do to output a variable to the client is:
echo outputThis($var);
Do any of you guys see any problems with my code? I want to make sure I leave no stone unturned since I am putting it up live for public. Thanks for your review.
Since I have to output a lot of variables to the client in php, I always have to constantly type:
Code: Select all
$var = 'test'
echo stripslashes(htmlentities($var, ENT_QUOTES, 'UTF-8'));Code: Select all
function outputThis($outputString)
{
$sendToBrowser = stripslashes(htmlentities($outputString, ENT_QUOTES, 'UTF-8'));
return $sendToBrowser;
}echo outputThis($var);
Do any of you guys see any problems with my code? I want to make sure I leave no stone unturned since I am putting it up live for public. Thanks for your review.