Jump to content

[SOLVED] Array question


CaptainChainsaw

Recommended Posts

 

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 :)

Link to comment
https://forums.phpfreaks.com/topic/115533-solved-array-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.