Re: Code formatting issue

From: Date: Tue, 19 Aug 2003 21:30:18 +0000
Subject: Re: Code formatting issue
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-160090@lists.php.net to get a copy of this message
this way may be what you'd like : $thing = new whatever (); $with = array (doStuff', anotherThing', doThis', doThat', doThis', doThat', anotherThing', doThis', /* etc. etc. */ ); foreach($with as $w) $thing->$w(); -- > Is there a way I can make this type of code neater? > > $thing = new whatever (); > > $thing->doStuff (); > $thing->anotherThing (); > $thing->doThis (); > $thing->doThat (); > $thing->doThis (); > $thing->doThat (); > $thing->anotherThing (); > $thing->doThis (); > // etc. etc. > > > Some languages have the construct "with", so you can so something like > this: > > $thing = new whatever (); > > with ( $thing ) { > > doStuff (); > anotherThing (); > doThis (); > doThat (); > doThis (); > doThat (); > anotherThing (); > doThis (); > // etc. etc. > } > > which is much neater. Is there anyway to do this type of thing with PHP?

« previous php.general (#160090) next »