I was reading somewhere that using global variables is generally a bad idea but I am not sure what the alternative is...

I have this code now and I need to use `global $config, $db` in every single function. = copy & paste

```
class Layout {

   public static function render($file, $vars) {

     global $config, $mysql_db;

     mysqli_query($mysql_db, "SELECT * FROM users");
}
}

```

Is there a better way to do this or do I need to use global keyword or define globals? Because I will need things like mysql connection variables in every function...