Can someone tell me what this is? ->

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lemonfreshmedia
Forum Commoner
Posts: 26
Joined: Fri Dec 02, 2005 7:14 pm

Can someone tell me what this is? ->

Post by lemonfreshmedia »

->

I see it all over but can find its definition anywhere.[/b]
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

it is how you call a method or property for an object.

ex:

Code: Select all

$someInstance = new someClass();
echo $someInstance->someMethod();
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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.
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

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

Post 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 ->.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

parser reads it as "T_OBJECT_OPERATOR"

as this examp will show:

Code: Select all

<?php

->

?>
Post Reply