Re: problem with class
| From: | Jonathan Pitcher | Date: | Fri, 25 Apr 2003 14:33:47 +0000 |
| Subject: | Re: problem with class | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-145266@lists.php.net to get a copy of this message | ||
When you want to global an array do it the same way you do a variable.
global $conf; // GOOD
global $conf[]; // BAD
remove the [] from your global line and you should be good to go.
Jonathan Pitcher
On Friday, April 25, 2003, at 09:38 AM, Prince wrote:
hi.. i have in an include file this: ##db.set## //variable used in other files $conf["date"]=date("M-d-Y"); $conf["log"]=date("M-d-y"); //...... ##end## now in the class file i have this: ##db.lib### require("db.lib"); classdb{ var $_db=""; global $conf[];//make the $conf array global now..worked //before but doesnt work now //now try to use it function Echo(){ echo $conf["date"]; echo $conf; }} ###end### now on output all i get for an error was parse error expecting t_old_function t_function t_var or } in db.lib on line 8 and for some reason it comes back to that $conf array in the other file... if i take out the global $conf[]; statement out of the class and put it just under the require statement or if i put it inside a function statement it will make the error go away but when i try to echo them it comes up with a blank screen what is wrong with it.. i did this once before and it worked but dont know why this time its not working... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php