Dumb question:
There is a piece of code that I want to modify. But I keep coming across the operator ->
What is it? Google search does not return anything sensible, probably because it ignores those characters. Same with devNet searches, php dot net. I am sure it is a simple thing, but I don't know php. Is it some kind of value assignment? Or is it passing values?
For example in:
return $this->data['title'];
what is the operator that comes after $this
Thanks
what is this thing: ->
Moderator: General Moderators
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
The "->" operator (in PHP) is how you access an object's functions and attributes.
Using it with the $this keyword implies that you are working within a class.
Code: Select all
$result = mysql_query($query);
$object = mysql_fetch_object($result);
echo $object->data;Using it with the $this keyword implies that you are working within a class.