What are the potential pitfalls of not properly declaring variables as global in PHP functions?

Not properly declaring variables as global in PHP functions can lead to scope issues, where the variable is not accessible within the function. To solve this problem, you can use the `global` keyword within the function to explicitly declare that the variable is from the global scope.

$globalVar = 10;

function myFunction(){
    global $globalVar;
    echo $globalVar;
}

myFunction(); // Output: 10