I bet this is pretty simple for you but it is still confusing me and I would like to understand this before I continue to learn more advanced stuff. So I hope you can make it clear for me.
The code is following:
class example
{
public function NumberInput($number)
{
$this->number = $number;
}
public function NumberOutput()
{
return $this->number;
}
}
$b = new example;
$b->NumberInput(7);
echo $b->NumberOutput();
So that code work fine, but I don't understand how exactly this part works:
public function NumberInput($number)
{
$this->number = $number;
}
What if I want for example input some number, but I wan't to save it in another variable, for example variable $a. This does not work ( and I don't know why):
public function NumberInput($number)
{
$this->number = $a;
}
Any explanation about this ?
Thanks in advance.