Jump to content

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


Edited by eldan88
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.