Try this: <?php class myObj { private $values = array(); public function __construct() { $this->values['ONE']=1; $this->values['TWO']=2; $this->values['THREE']=3; foreach ($this->values as $key => $value) echo $key.'=>'.$value.'<br />'; } //Return key value if assigned, else return not assigned public function get($key) { echo "key=$key"; echo "value=$values[$key]"; if (isset($this->values[$key])){ return $this->values[$key]; } return 'Not assigned!'; } } $var = new myObj; echo 'The value is: '.$var->get('ONE'); ?> Mary-Anne ----- Original Message ----- > What is wrong with this code? It is as simple as all get out yet it > doesn't work!!! Does anyone have any clues? > > > <?php > > class myObj > { > private $values = array(); > > public function __construct() { > $values['ONE']=1; > $values['TWO']=2; > $values['THREE']=3; > > foreach ($values as $key => $value) > echo $key.'=>'.$value.'<br />'; > } > > //Return key value if assigned, else return not assigned > public function get($key) { > if (isset($values[$key])){ > return $values[$key]; > } > return 'Not assigned!'; > } > > } > > $var = new myObj; > echo 'The value is: '.$var->get('ONE'); > > ?> > > -- > Brian Marple > Systems Analyst