What does the "->" operator do?

What does the "->" operator do?

by Jeremy Winch -
Number of replies: 4
Does anyone know what the "->" means exactly? My guess is it's something 
like $table->element, but I'm not sure.

Also, is there anything specific that I need to alter in order to acess new tables
in this manner?
Average of ratings: -
In reply to Jeremy Winch

Re: What does the "->" operator do?

by Zbigniew Fiedorowicz -
It selects a field in a record of a table. For example if we use a database call to obtain your user record in the Using Moodle course and copy it to the variable $user, then $user->firstname would be Jeremy, $user->lastname would be Welch, etc.
In reply to Zbigniew Fiedorowicz

Re: What does the "->" operator do?

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
What Zig's written is indeed correct in practical terms most of the time in Moodle.

To be slightly more correct with the terminology though (which may help reading the PHP documentation), $user is an object, and firstame and lastname are properties of that object.