This forum is now read-only. Please use our new forums! Go to forums

0 points
Submitted by ConDug
almost 9 years

Parse error: syntax error, unexpected T_OBJECT_OPERATOR on line 18

As in Exercise 5 of “Using Objects in PHP” there seems to be an error which is here no matter what I change. This is the base error I get get when the exercise loads for the first time. On exercise 5, I was able to progress even though I had a similar error which was related to my first this->firstname = $firstname; line of code. Anyone able to explain this?

Answer 55187bd086f552fdd20045c5

0 votes

Permalink

if you don’t mind posting your code? it’s easier to see what you did there and it did be easier to explain what you had done wrong =) FYI, read on previous chapter, it did explain that sentences what it meant and it’s purpose of way.

points
Submitted by Eden
almost 9 years

2 comments

code2learn almost 9 years

I get that issue in line 20, it has some thing to do with the (public function __construct($firstname, $lastname, $age)) please let me know what I have wrong.

Eden almost 9 years

HI code2learn, Just to revise back those previous lesson that you might been missing out or skipped through. Brackets, Parenthesis, Coma, Semicolons are very sensitive and critical. To guide you better on this. this->firstname = $firstname; and $this->firstname = $firstname; are completely different meaning and an error. The missing & sign on the above comparison, it’s common to be found in most method declaration way. It will be hard for me to explain but once you finish up the lesson you might understand that $this->firstname = $firstname; holds a part of the method declaration way.Let me know if you find me wrong since I’m partly learning as well.