Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is this called in php: -> [duplicate]

Tags:

php

Possible Duplicates:
In, PHP, what is the “->” operator called and how do you say it when reading code out loud?

I use it all the time, it's impossible to search for. What is the technical name for it?

like $object->property

UPDATE: I see now that someone asked this question before, but when you search for something like "php ->" you don't get good results.

like image 891
pfunc Avatar asked Jan 31 '11 22:01

pfunc


People also ask

What does this -> mean in PHP?

The object operator, -> , is used in object scope to access methods and properties of an object. It's meaning is to say that what is on the right of the operator is a member of the object instantiated into the variable on the left side of the operator.

What is the arrow called in PHP?

What is -> in PHP? This is referred to as the object operator, or sometimes the single arrow operator. It is an access operator used for access/call methods and properties in a PHP object in Object-Oriented Programming (OOP).

What is clone in PHP?

The clone keyword is used to create a copy of an object. If any of the properties was a reference to another variable or object, then only the reference is copied. Objects are always passed by reference, so if the original object has another object in its properties, the copy will point to the same object.

Which method is used to create duplicates?

An object copy is created by using the clone keyword (which calls the object's __clone() method if possible).


1 Answers

Simply enough, it's called the arrow operator

ETA:

As others have mentioned, the documentation also calls this token the "object operator". So, the docs aren't entirely self consistent, which I suppose is true of any real world documentation.

like image 151
Eric Petroelje Avatar answered Oct 23 '22 19:10

Eric Petroelje