I am fairly new to PHP and I have found that a lot of my functions require access to the database. The problem is I currently connect to the database in a file that I require at the top of every page like so:

```
$db = new mysqli("localhost", "my_user", "my_password", "world");

```

The problem I find is then when I want to access it within a function I have to pass the $db variable to it... which works fine, but is there an easier way?