Using a string from another function

From: Date: Mon, 06 Nov 2000 01:48:45 +0000
Subject: Using a string from another function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-23827@lists.php.net to get a copy of this message
Ive come across this problem and im not sure how to solve it. I have a file (stuff.inc) that has all my working and layout functions in it. This file is included at the top of each php file using include() so I can call on the functions.... All A-OK so far. What my concept is, I want to be able to specify a color scheme using one of the functions. This function sets 2 variables........ function color_scheme($scheme) {
        if ($scheme==1) {
                $color1="#973100";
                $color2="#FEFFCA";
        }
        global $color1, $color2;
} If I want to use $color1 or $color2 in my php file, its fine. But my problem is, I use another function to generate a whole bunch of HTML table output based on my outputted data and structured arrays. When I call this function, I cannot use $color1 or $color2 anymore. Is there a way to make a string not only globally usable for the php file being processed, but from all included files as well ? If I have left any info out, or can be more clear on something, please let me know, but this one is baffling me. Chris

« previous php.general (#23827) next »