Jump to content

Need help working with property visibility


eldan88

Recommended Posts

Hey Guys. I am trying to assign a property through a method that is called in a swtich method. 

 

After the property gets "assigned" I do a var_dump on the property and it returns NULL?

 

I am not sure why it returns NULL.... I would really appreciate any help...

class Tea {
 
 
 public $current_tea;
//Current tea does not get assigned when using the AssignTea($TeaArg) function
 
 private $upcoming_tea  = "Blacktea";
 
 public function SelectTea() { 
  $TeaType = "Black";
 switch ($TeaType) {
    case "Black":
$this->AssignTea($this->upcoming_tea);
    break;


}// End of Swtich
 
 
}// End of function SelectTea()


private function AssignTea($TeaArg){
 
 $this->current_tea = $TeaArg;
 
}



}
$tea = new Tea();
var_dump($tea->current_tea);


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.