Re: PHP Syntax Notation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Lowell,

The "->" operator was taken from the pointer operator in C.  It's used to 
access a method or variable within an INSTANCE of an object, as opposed to 
the "::" operator, which is used to access a static method of a class.  Note 
the difference between a class and an object -- an object is an instance of 
a class.

if Run() is a static method (I.E. it has no references to "$this") and 
"$site" is an instance of "SiteClass", the following are equivalent:

$site->Run();
SiteClass::Run();

If you're still confused, I can go further into the difference between an 
Object and a Class.

-- 

Sincerely,

A.J. Brown
BitNotion Technologies


"Lowell Herbert" <lherbert@xxxxxxxxxxxxx> wrote in message 
news:89AE1FAA-9939-4B28-BD4E-71CBEAC2E7EF@xxxxxxxxxxxxxxxx
>
> On Sep 27, 2005, at 2:16 PM, Mikey wrote:
>
>> Lowell Herbert wrote:
>>
>>
>>> I'm trying to expand my understanding of PHP by looking at some  pre- 
>>> built code modules.  I don't fully understand the syntax  "$site->Run 
>>> ();" in the following code.  Can someone offer a  helpful explanation?
>>>
>>> <?php
>>>
>>> //define("PB_CRYPT_LINKS" , 1);
>>> define("_LIBPATH","./lib/");
>>> require_once _LIBPATH . "site.php";
>>>
>>> $site = new CSite("./site.xml",true);
>>> $site->Run();
>>>
>>> ?>
>>>
>>
>> Run() is a method of the CSite class - you will need to look in the 
>> defination of that class to find out what it does,
>>
>> Mikey
>>
>
> Thanks for all the responses.  I understand that $site is an instance  of 
> the class CSite, and that Run() is a function in that class.  I do  not 
> understand what the operater "->" means, and what meaning the  result of 
> the function Run() has to $site.  Clarification anyone?
>
> Thanks in advance,
> Lowell 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux