Re: PHP Object Constructors

From: Date: Sat, 16 Sep 2000 16:07:47 +0000
Subject: Re: PHP Object Constructors
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-17031@lists.php.net to get a copy of this message
Take a look at the manual for an explanation of how constructors work in PHP. http://www.php.net/manual/language.oop.php --------------------------------------------------------- Conceive. Create. myClientManager.com. --------------------------------------------------------- - ----- Original Message ----- From: "The Captain" <rob@siliconcarne.net> To: <php-general@lists.php.net> Sent: Friday, September 15, 2000 1:18 PM Subject: [PHP] PHP Object Constructors > I was wondering how I could pass a value to a constructor. Let's say my > object looks like this: > > class openFile { > var $filename; > var $fp; > > function openFile() { > /* filename not assigned */ > } > > function openFile($f) { > $this->filename = $f; > } > } > > > What I'm wondering is how you can pass that filename variable into the > constructor. PHP yells when I type: > > $of = new openFile("/var/logs/log_file"); > > Is this possible? > > Thanks in advance > > > -- > 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 (#17031) next »