Re: What is $this->

From: Date: Mon, 19 Feb 2007 12:21:45 +0000
Subject: Re: What is $this->
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-249014@lists.php.net to get a copy of this message
oops, typo. Should have been $this->message. Leonard On 2/18/07, André Medeiros <andre.caum@gmail.com> wrote:
Actually, $this->$message would be wrong, but the concept is right. On 2/19/07, Leonard Burton <leonardburton@gmail.com> wrote: HI,
$this->SetFont('Arial','B',15);
what you include is a snippet from a class. Here is a brief into to how a class works, sort of like a function. The $this refers to the class from inside of the class. <?php class write{ var $message; function set($message){
               $this->$message = $message;
} function display(){
              print "$this->message\n";
} }// class write //actually use the class $class = new write(); $class->set("This is a test message"); $class->display(); ?> I hope this helps. Leonard -- Leonard Burton, N9URK http://www.jiffyslides.com service@jiffyslides.com leonardburton@gmail.com "The prolonged evacuation would have dramatically affected the survivability of the occupants." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- Leonard Burton, N9URK http://www.jiffyslides.com service@jiffyslides.com leonardburton@gmail.com "The prolonged evacuation would have dramatically affected the survivability of the occupants."

« previous php.general (#249014) next »