Topic awaiting preservation: What's -> in php do? (Page 1 of 1) |
|
---|---|
Paranoid (IV) Inmate From: 1393 |
posted 05-09-2006 23:05
What the heck does -> do in php? For example: code: $this->someFunction();
|
Paranoid (IV) Inmate From: Norway |
posted 05-09-2006 23:11
In this case it would call the method someFunction() of the local object. |
Paranoid (IV) Inmate From: 1393 |
posted 05-10-2006 00:19
ah, it's an OOP thing. I wasn't sure what to search for as "->" doesn't cut it. Thanks! |
Maniac (V) Mad Scientist From: :morF |
posted 05-10-2006 00:43
I think it's called a reference point. In the case you showed, yes, it's an OP reference, calling to a method inside a defined class. It's also used in PHP's open objects. You can, for example, call up a record set using MySQL, and store it in $result. You can then call, say, $resobj = mysql_fetch_object($result) and you will end up with an object with a series of arrays in it, containing each of the records in your result, listed by column name. So, if your columns were ID, FirstName, LastName, you could do: code: foreach ($resobj as $recobj) { echo $recobj->ID." "; echo $recobj->FirstName." "; echo $recobj->LastName."<br />"; }
|
Nervous Wreck (II) Inmate From: |
posted 05-10-2006 09:44
Two notes: |