Can someone explain what is the difference in scope here
If in my functions.php I had this
$blue = 'blue';
function red() {
echo 'red';
}
then in sidebar.php
<?php echo $blue; ?>
<?php red(); ?>
If I included the sidebar with get_sidebar(), which involves a “require”, the function red() is available and works, but the variable blue does not exist.
My question is, why is the function red() available, but the variable $blue, not available? (unless I make $blue a global).