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

Objects in PHP Forum

View Course » View Exercise

146 points
D211dc03d1527c910acffa6fb5f73db8?s=140&d=retro
Submitted by
Mie Rex
about 2 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

permalink

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

646 points
51bb5ed6282ae3559000b9ad_830539228
Submitted by
Abdellah
about 2 years ago