Re: Returning an object

From: Date: Fri, 07 May 2004 02:25:12 +0000
Subject: Re: Returning an object
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-185583@lists.php.net to get a copy of this message
* Thus wrote Aidan Lister (aidan@php.net): > How _should_ this be done? In terms of "best practice". > > <?php > function foobar () > { > return new SomeObject; > } > ?> > > Or: > > <?php > function barfoo () > { > $tempvar = new SomeObject; > return $tempvar > } > ?> I'm not exactly sure what your looking for, this is like asking what is better: $a = 'foo'; echo $a; or echo 'foo'; if tou want my opinion it should be written like this: <?php /* * Create an instance of SomeObject */ function foobar() { return new SomeObject; } > Please don't reply if you really, really don't know what you are talking > about. What kind of requirement is this? Anyone can reply your email and they will do so if they feel like it. Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#185583) next »