I'm not new to programming but I am very new to PHP. I just can't figure out why this variable is not being recognised. I have a file called utils.php in directory utils
like this:
<?php
$the_var = 'A'
function foo($bar) {
echo $bar;
}
?>
...and another file called work.php in a parent directory of utils like this:
<?php
include('utils/utils.php');
function doIt() {
echo $the_var; // is always empty
foo('bar'); // no problem
}
?>
Why can't the variable $the_var
be accessed?