Here is a shortened version of my code:
<?php
$foo = "Bar";
function test () {
echo $foo; // Undefined variable?
}
test();
?>
I don't understand, why PHP says, that $foo
is undefined. And I always find solutions for deactivating the error reporting, but I want to fix my code. What am I missing?