Question: I'm using HHVM to write a system tool and I cannot for the life of me figure out why this code issues an error when I run `hh_client`

```
$__al_paths = array();

function requires(string $classPath): void {
    global $__al_paths;
    $className = basename($classPath);
    if (!isset($__al_paths[$className])) {
       $__al_paths[$className] = AL_CLASSES_FOLDER.'/'.$classPath.'.'.AL_CLASS_EXTENSION;
    }
}

```

This issues the following when I run `hh_client`

```
/usr/lib/mango/tools/autoloader.hh:9:9,19: Expected

```

The line it is pointing to is the line that says

```
global $__al_paths;

```

Which is being declared in the `global` scope. This appears to be a syntax error, it is as if the `global` keyword is not supported on HHVM, however I checked the documentation and it has several examples of it being using in Hack code.

Answer: 
First, HHVM itself supports everything from the PHP language when you're writing PHP code, including `global`. This restriction is due to your usage of the Hack language -- `global` is one of the things that we removed from the language. If you really really need globals, you can use `$GLOBALS` in partial mode only, but [strict mode](http://docs.hhvm.com/manual/en/hack.modes.php) disallows them altogether. (And if you see our documentation using `global`, it's wrong, please use the button on the page to file a bug!)
Instead of using `global` try to rewrite your code like this (called dependency injection):

```
function requires(string $classPath, $__al_paths): void {
    $className = basename($classPath);
    if (!isset($__al_paths[$className])) {
       $__al_paths[$className] = AL_CLASSES_FOLDER.'/'.$classPath.'.'.AL_CLASS_EXTENSION;
    }
}

```

Then call it like:

```
$__al_paths = array();

requires('classpath', $__al_paths);

```

This way you produce much more flexible and more stable code than playing around with globals which should been deleted from every humans mind.