Hi,
Yes, as you guessed I not only have problem with leslie outside the virtual world, but I also have problem with her in the first class I ever wrote for her (of course she is fictional guys. I don't mean to get your hopes up guys). Well here she is:
<?php
class Human
{
private $attribute = array ('hair', 'eyes', 'height', 'weight');
function __get($feature, $value)
{
foreach($attribute as $feature => $value)
echo $feature.'=>'.$value.'<br />';
}
function __set($feature, $value)
{
$this->attribute [$feature] = $value;
}
}
$leslie = new Human();
$leslie->hair = "blond";
$leslie->eye = "green";
$leslie->height = "5 10";
$leslie->weight = "116";
?>
Can someone help me fix her please. My problems with her:
1) Do I have the right idea by thinking of her attributes as such? I mean I can change the attributes to anyone else and this would be a good use of a class, no?
2) I am trying to print out her attributes, but I can't
I will take any SIMPLE suggestions. Please remember I just wrote my first class ever.
Thnks everyone