Function not behaving in the same way as normal code
Posted: Sat Aug 23, 2008 8:24 pm
I had a function that looks like this:
It did not work properly, so I cut it down to:
...and then added the removed functionality directly to the code:
This did work.
Can anyone explain why the behavior differed?
(If it matters, the "not working" thing was it not recognizing variables that are defined in the header. I use a very simple template system.)
Code: Select all
function error($message) {
echo $message;
require_once('footer.php');
exit;
}
Code: Select all
function error($message) {
echo $message;
}
Code: Select all
error("The style you selected does not appear to exist.");
require_once('footer.php');
exit;
Can anyone explain why the behavior differed?
(If it matters, the "not working" thing was it not recognizing variables that are defined in the header. I use a very simple template system.)