note 22504 rejected from functions by didou
| From: | didou@php.net | Date: | Sun, 05 Oct 2003 16:36:43 +0000 |
| Subject: | note 22504 rejected from functions by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57847@lists.php.net to get a copy of this message | ||
Note Submitter: devciti@yahoo.com
----
I have some problems with functions. I want to create some kind of 'tell me the configuration
function'. Like this:
<?php
function TellConfig(){
$header_file_to_use = "header.inc";
$footer_file_to_user = "footer.inc";
}
//Wont Work!
TellConfig();
include($header_file_to_use);
echo "Body!";
include($footer_file_to_use);
/*
Is there a way to call a variable set by a function? As i dont know this is the way i am doing it
*/
$header_file_to_use = "";
$footer_file_to_use = "";
function TellConfig2(){
global $header_file_to_use, $footer_file_to_use;
$header_file_to_use = "header.inc";
$footer_file_to_use = "footer.inc";
}
TellConfig2();
include($header_file_to_use);
echo "body 2!";
include($footer_file_to_use);
// This works
?>
Even i dont want to use a function for configuration vars this is a good example.
:P