RE: [PHP4BETA] Object Oriented Programming

From: Date: Wed, 29 Mar 2000 20:41:29 +0000
Subject: RE: [PHP4BETA] Object Oriented Programming
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-12832@lists.php.net to get a copy of this message
You don't need to specify $this in the parameter list to the function. If the properties are already defined var at the top of your class, you can just do $this->seshid within your function. If you need to pass in parameters just use func(x, y) { AZ > -----Original Message----- > From: Louisiana Attorneys Network > [mailto:louisian@louisiana-attorneys.net] > Sent: Wednesday, March 29, 2000 12:37 PM > To: php4beta@lists.php.net > Subject: [PHP4BETA] Object Oriented Programming > > > I'm using PHP 4 and am trying to branch into Object oriented programming. > I've copied examples from the Profesional Php Programming book. > Problem is I > keep getting an error when defining a function in a class. Here is an > abbreviated form of the > > class Session > { > // Define the properties: > > var $seshid; > var $userid; > > // Define the methods: > > function Session($this->seshid,$this->userid=0){ > // connect to MySQL etc > } > } > I get a parse error that PHP is expecting a closing ')' even though there > are the correct number of parenthesis on the line with function > Session. It > seems that it's not liking the "$this->" syntax. Does anyone know why? > Thanks > Scott > xjab@fastband.com > > > -- > PHP 4.0 Beta Mailing List <http://www.php.net/version4/> > To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net > For additional commands, e-mail: php4beta-help@lists.php.net > To contact the list administrators, e-mail: php4beta-admin@lists.php.net >

« previous php.version4 (#12832) next »