I am using the EOF function in my php code.
But I have a problem.
When I try to call a variable from another file, it simply ignores it.
I have a variable in another file(header.inc.php) that looks like this:
$site['url'] = "http://www.mydomainname.com";
Then I put the require function where the EOF code is:
require_once('../../inc/header.inc.php');
The file where the EOF code is , looks like this:
function getServices() {
$sCode .= <<<EOF
<a href="{$site['url']}" class="amenu">Home</a>
EOF;
return $sCode;
}
The variable $site['url'] is empty when I then call that function..
This is driving me crazy! Is there any reason why the EOF code should ignore that variable??
EOFis not a function. You're referring to "heredoc syntax" for delimiting strings. The delimiter you choose (e.g.EOF) is relatively arbitrary.