What potential pitfalls should be considered when using global variables in PHP functions?

Using global variables in PHP functions can lead to issues with variable scope, readability, and maintainability. It can make it difficult to track where a variable is being modified or accessed within the code, leading to potential bugs and conflicts. To avoid these pitfalls, it's recommended to pass variables as parameters to functions rather than relying on global scope.

// Avoid using global variables in functions
$globalVar = 10;

function multiplyByGlobal($number) {
    global $globalVar;
    return $number * $globalVar;
}

echo multiplyByGlobal(5); // Output: 50
```

Instead, consider passing variables as parameters:

```php
// Pass variables as parameters to functions
$globalVar = 10;

function multiplyBy($number, $multiplier) {
    return $number * $multiplier;
}

echo multiplyBy(5, $globalVar); // Output: 50