This is a quick one...
I'm currently learning about the use of global/static/local PHP variables, and would like some clarification on whether or not the use of a 'global' variable in this function is correct:
$mysqli = new mysqli($DBServer, $DBUser, $DBPass, $DBName);
function sanitise($var) {
global $mysqli;
$var = strip_tags($var);
$var = htmlentities($var, ENT_NOQUOTES);
$var = stripslashes($var);
return $mysqli->real_escape_string($var);
}
The function will be used across a number of PHP files.
Many thanks!!