@orreipMay 05.2006 — #Private limits visibility only to the class that defines the item. Read the manual about members visibility. The meal variable is null as you defined your class.
i'm guessing that you're trying smt. like :
$h=new Human;
$h->meal="ham"; //you cannot assign this outside of your class
echo $h->eat();
you can use:
public $meal;
or define another method in your class:
public function setMeal($string)
{
$this->meal=$string;
}
and use $h->setMeal("ham");
This is only if you're using PHP5. The other ones doesn't support private, public, protected.
@NogDogMay 05.2006 — #Let us know if you're using PHP4 or PHP5, as PHP4 does not support as much object-oriented functionality as PHP5 does (such as the "private" declaration).