I have a variable named $url in the top of my file:
<?php
$url = "http://myurl.com";
Later in the same file, I have this code:
<?php
$url = "http://myurl.com";
[...]
function errorOut($error, $type = "info", $rel = "/")
{
    echo $url;
}
?>
However, that doesn't work, because it says $url isn't a valid variable. I have to do this:
<?php
$url = "http://myurl.com";
[...]
function errorOut($error, $type = "info", $rel = "/")
{
    $url = "http://myurl.com";
    echo $url;
}
?>
This doesn't make any sense to me because it shouldn't be out of scope because it's a layer above the function. How do I make it use the earlier $url variable? 
 
     
    