How can I call following Class method or function?
Let say I have this params get from url:
$var = filter($_GET['params']);
Class:
class Functions{
public function filter($data){
$data = trim(htmlentities(strip_tags($data)));
if(get_magic_quotes_gpc())
$data = stripslashes($data);
$data = mysql_real_escape_string($data);
return $data;
}
}
thanks.
Functions::filter()is code that you intend to use, please be aware that the php mysql_* extension has been deprecated. Use mysqli_* or pdo_* and strongly consider using prepared statements (which will remove the need for your function anyway).