Ok, I'm pretty sure you have a point there, but I can't really see it to
be honest.
First of all, let's start out with the usual: RTFM! This page:
http://www.php.net/oop should explain basic class/object/method/member
terminology required to understand what's going on here.
In short you could say:
a 'class' is a collection of functions (known as 'methods') and
variables (known as 'members'). A class is a static structure. Each
class can spawn so-called 'objects' which are instances of that class,
more-or-less something like a copy (better explained in the manual,
linked).
In an object (note, not the class, but the object) the variable $this
references that object (it references itself basically). -> is an
operator stating 'perform the right-hand action on the left-hand object
(referenced by that variable). So $object->help() will call the function
help() on the object referenced as $object.
Now, I suggest you read trough the entire oop section of the manual to
find out more in detail and better wording.
- tul
Sancar Saran wrote:
Hi,
I believe there are more offical answes available at around the web.
This is what I understand $this->
This is a base OO programming thing.
IN oo world you have to create new object to do someting.
like
$db = new adodb;
so after the generate object you will modify this object via functions.
$db->execSql($sql);
when you send this command, your class have to do someting with the object...
and program have to know which object?, because you can create unlimited
amount of object from same code. So. $this points current object.
when you do someting with any object, inside of his class code his name was
always $this.
Hope helps.
Sancar
On Monday 19 February 2007 02:52, Dick Richard wrote:
Can someone explain what $this-> does and means. For example what does this
bit ot php code mean?
$this->SetFont('Arial','B',15);
Thanks
dvrichard@xxxxxxxxxxx
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php