This forum is now read-only. Please use our new forums at

Objects in PHP Forum

View Course » View Exercise

146 points
Submitted by
Mie Rex
almost 3 years ago

The explanation of echo $age->age ;

    $teacher = new Person("boring", "12345", 12345) ;
        echo $isAlive->isAlive ;
    $student = new Person("Hubert J.", "Farnsworth", 165) ;
        echo $age->age ;

this is part of my code for this exercise
I am not quite sure why is there a "->" for the echo
To my understanding the -> means that $age is a parent of age
not sure what's that mean though
Could anyone explain the meaning of this line "echo $age->age ;" to me please?

Thank you for all your time!!

0 votes


if you want to print the age just write it like that : echo $student->age;

650 points
Submitted by
almost 3 years ago