PHP Object Constructors

From: Date: Fri, 15 Sep 2000 18:18:39 +0000
Subject: PHP Object Constructors
Groups: php.general 
Request: Send a blank email to php-general+get-16952@lists.php.net to get a copy of this message
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

« previous php.general (#16952) next »