Hi,
I want to know how did I came up with this error when I run my code:
Trying to get property of non-object in line 19.
What does it mean?
I want to echo out My favorite candy is M&M Peanuts.
But instead I echo out My favorite candy is
.
Here is my code:
<?php
class candy {
public $MnM='M&M Peanuts';
public function __construct($MnM)
{
$this->MnM = $MnM;
}
public function get_MnM()
{
return $this->MnM;
}
}
echo 'My favorite candy is '. $MnM->MnM.'.';
?>
Any Suggestions and explanation will help. I appreciate it. Thank!