Re: help with classes

From: Date: Tue, 13 Feb 2001 07:00:37 +0000
Subject: Re: help with classes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-39373@lists.php.net to get a copy of this message
you do this in the class constructor class foo { var $bar; function foo($fooval) { $this->bar=$fooval; } } hope that helps Ankur Verma HCL Technologies A1CD, Sec -16 Noida, UP India ----- Original Message ----- From: "Joseph H Blythe" <joe@binarylogic.com.au> To: "php-general" <php-general@lists.php.net> Sent: Wednesday, February 14, 2001 9:27 AM Subject: [PHP] help with classes > hey all, > > Was just wondering how to do the following: > > <?php > class Foo { > > var $bar = $foo; // causes parse error > var $bar = "$foo"; // causes parse error > var $bar = '$foo'; // works but $foo is not evaluated > > } > ?> > > So how does one correctly assign a variable to a variable inside a class withot doing something like: > > var $bar = ''; > $this->bar = $foo; > > Any insight would be much appreciated. > > Regards > > Joseph > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#39373) next »