What are the potential issues with using global variables in PHP functions and how can they be avoided?

Using global variables in PHP functions can lead to potential issues such as code readability, maintainability, and the risk of unintended variable modification. To avoid these issues, it's recommended to pass variables as function parameters or use the `global` keyword inside the function to access global variables. Example PHP code snippet:

// Potential issue with global variable
$globalVar = 10;

function incrementGlobalVar() {
    global $globalVar;
    $globalVar++;
}

incrementGlobalVar();
echo $globalVar; // Output: 11
```

To avoid using global variables, pass the variable as a parameter:

```php
$globalVar = 10;

function incrementVar($var) {
    return $var + 1;
}

$globalVar = incrementVar($globalVar);
echo $globalVar; // Output: 11