Page 1 of 1

Can someone tell me what this is? ->

Posted: Mon Dec 19, 2005 4:44 pm
by lemonfreshmedia
->

I see it all over but can find its definition anywhere.[/b]

Posted: Mon Dec 19, 2005 4:50 pm
by Burrito
it is how you call a method or property for an object.

ex:

Code: Select all

$someInstance = new someClass();
echo $someInstance->someMethod();

Posted: Mon Dec 19, 2005 5:33 pm
by Chris Corbyn
Which is the same as the dot in Java or C++ ;)

EDIT | You'll also see :: used too. someClass::someMethod() -- That's static and is *basically* another way to refer to a class but not in an object sense.

Re: Can someone tell me what this is? ->

Posted: Mon Dec 19, 2005 11:19 pm
by Roja
lemonfreshmedia wrote:->

I see it all over but can find its definition anywhere.[/b]
Read it from Right to Left (backwards for most of the west) as "OF".

So:

SomeClass->SomeMethod();

Would read:

SomeMethod OF SomeClass.

I've heard it done with "IN", but I don't particularly like that interpretation and implication.

The double-colon ( :: ) is called Paamayim Nekudotayim, which in Hebrew means (almost literally) double-colon. But to be honest, I don't know the technical name for ->.

Posted: Tue Dec 20, 2005 12:34 am
by Jenk
parser reads it as "T_OBJECT_OPERATOR"

as this examp will show:

Code: Select all

<?php

->

?>