Re: Array with $ problem

From: Date: Fri, 13 Oct 2000 21:09:42 +0000
Subject: Re: Array with $ problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-20086@lists.php.net to get a copy of this message
On Fri, 13 Oct 2000, Jay Beaton wrote: > You can do it, but you'll need to use "eval()". It would look a little > like this... > > <? > $middle = " \"TYPE\"=>\"select\", > \"NAME\"=>\"sex\", > \"SIZE\"=>1, > \"VALUE\"=>\"NULL\", > \"OPTIONS\"=>array( \"NULL\"=>\"Please > Select\", > \"M\"=>\"Male\", > \"F\"=>\"Female\"), > \"ValidationErrorMessage\"=>\"Must select sex\" > "; > > eval("\$aArray = array($middle);"); > > $subscription->AddInput($aArray); > ?> Am I the only one that finds all those escaped quotes completely unsightly? Why bother with it, when that whole thing is static content? Change the outermost quotes to single quotes, and it will look much cleaner. Matt

« previous php.general (#20086) next »