jasondavis wrote:sorry you just pointed out a typo, so lets say FilterHTML is both functions or vice versa, so it is calling the same function 2 times, also all it does it preg_replace any html code and return the string
That is why it is a good idea to copy and paste code rather than writing it again. Then you won't get those typos.
Anyway I would recommend the one below:
if($company_name != NULL) {
$company_name = FilterALLHTML($company_name);
}
It is basically the way to do it. I doubt that you even can replace anything in the value NULL.
Of course, there is another way that might be even better. In the function first check if it is null, and if it is then return null. If it is anything else run whatever you want to run. Then you are sure the check is run every time, and you don't have to worry about it outside the function. The only thing you need to know then is if the variable is set or not.