Re: A cleaner way to do this?

From: Date: Thu, 25 Mar 2010 17:26:57 +0000
Subject: Re: A cleaner way to do this?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-303456@lists.php.net to get a copy of this message
Paul Halliday wrote: > > Is there any way to clean this up a bit? > This is what I usually do: if ( ($matches=preg_match(linepattern1,text,match))>0 ) { // do stuff speicifc to linepattern1 } else if ( ($matches=preg_match(linepattern2,text,match))>0 ) { // do stuff speicifc to linepattern2 } else if ( ($matches=preg_match(linepattern3,text,match))>0 ) { } else if ( ($matches=preg_match(linepattern4,text,match))>0 ) { } -- Per Jessen, Zürich (15.9°C)

« previous php.general (#303456) next »