Re: $this->
| From: | 1LT John W. Holmes | Date: | Mon, 29 Apr 2002 14:50:25 +0000 |
| Subject: | Re: $this-> | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-95166@lists.php.net to get a copy of this message | ||
It's used in object oriented programming (OOP) with classes. $this refers to
the current object.
So $this->setup() in PHPLib is referring to the setup() function within the
object.
You can get a better explanation and examples by reading the manual page on
OOP.
http://www.php.net/manual/en/language.oop.php
---John Holmes...
----- Original Message -----
From: "Steve Buehler" <steve@vespro.com>
To: <php-general@lists.php.net>
Sent: Monday, April 29, 2002 10:37 AM
Subject: [PHP] $this->
> I am not an expert at PHP and have been learning it through questions,
> books, online help, etc.... I guess like most people. :) Anyway, I see a
> lot of scripts that use $this->something and was wondering if this was
just
> another variable or if the "->" has any special meaning. One script from
> the PHPLIB (menu.inc) has this:
> $this->setup();
> and there are no other times in that .inc file that lists that. The only
> other thing that comes close is just the "funtion setup()". This is not
> the only program that I see this in and am just wondering about it and
> trying to see if it is something that I should be using in my scripts.
The
> only time that I use this is when getting results from a mysql query like
this:
> $result=mysql_query("SELECT $team from games where game_id = '$game_id'");
> while (($row = mysql_fetch_object($result))){
> $input = $row->$team;
>
> Hopefully somebody can explain this to me.
>
> Thanks in Advance
> Steve
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>