Re: instantiating objects

From: Date: Thu, 06 Feb 2003 17:09:07 +0000
Subject: Re: instantiating objects
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-134647@lists.php.net to get a copy of this message
http://www.php.net/manual/en/language.references.php http://www.php.net/manual/en/language.oop.php Examples 1 and 4 are equivalent Example 2 assigns a reference of the new object to $form Example 3 assigns the value from the DB class method connect() to $dbh (could be an object or some other value) Example 5 is the same as 3 except that it assigns a reference of the value returned from the Mail class method factory() to $mail_object. Justin Garrett "Beau Hartshorne" <beau@members.evolt.org> wrote in message news:000001c2ce00$d19797d0$6401a8c0@laptop... > I'm just starting to use PEAR, and have seen several ways of > instantiating the PEAR objects: > > $form = new HTML_QuickForm(); > $form =& new HTML_QuickForm(); > $dbh = DB:connect("dsn"); > $dbh = new DB(); > $mail_object =& Mail::factory('sendmail', $params); > > Can anyone explain (or point to dome docs that explain) what the > differences are, and when I should be using which method to work with > PEAR objects? > > Thank you, > > Beau > >

« previous php.general (#134647) next »