ONE=>1 TWO=>2 THREE=>3 The value is: Not assigned! value is not assigned in for each != private values On Jun 30, 2012, at 9:17 PM, Brian Marple wrote: > 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 > > > > Lee T. Davy - Mini Play Cool Games play@xxxxxxxxxxxxx