CaptainChainsaw Posted July 18, 2008 Share Posted July 18, 2008 Hi all, I'm wanting to store all configurable parts of my website in one file which looks something like this: class conf{ private $_confdata=array("dbhost" => "hostname", "doboptions" => array( 'language' => 'en', 'format' => 'dMY', 'minYear' => 1930, 'maxYear' => 2008 ) ); public function getConfItem($key){ return $this->_confdata[$key]; } } I access single values like so: $conf->getConfItem('key') I want to assign the "doboptions" array to a variable, a bit like: $doboptions = $conf->getConfItem('doboptions'); This doesn't work, it appears that the array assigned to "doboptions" is breaking it. Anyone have any suggestions? Thanks again, CC Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted July 19, 2008 Share Posted July 19, 2008 Well what does your getConfItem() function look like? Quote Link to comment Share on other sites More sharing options...
TempleDMDKrazd Posted July 19, 2008 Share Posted July 19, 2008 $conf = new conf; $doboption = $conf->getConfItem("doboptions"); print_r($doboption); //should print the content of the return array Quote Link to comment Share on other sites More sharing options...
arifsor Posted July 19, 2008 Share Posted July 19, 2008 your mension script is working properly! whats the error you getting Quote Link to comment Share on other sites More sharing options...
CaptainChainsaw Posted July 19, 2008 Author Share Posted July 19, 2008 ok, problem solved ....... I was missing a comma in the conf class *sigh*. Thanks for all your posts! CC Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.