Re: HELP - Clean and simple

From: Date: Mon, 22 May 2006 17:18:07 +0000
Subject: Re: HELP - Clean and simple
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-236653@lists.php.net to get a copy of this message
On 5/22/06, Jonas Rosling <webmaster@gamearena.se> wrote:
while($row=mysql_fetch_array($result)) {
        if (!$$row[0]) {
                $$row[0] = array();
                $$row[0][$row[2]] = $row[1];
        }
        else {
                $$row[0][$row[2]] = $row[1];
        }
}
IMO, unless you have a *really* good reason for doing things this way, putting values into an array is almost always better than using the "$$" direct declaration. i.e. why not use? $vars[ $row[0] ][ $row[2] ] = $row[1]; -- Scott Hurring [scott dot hurring dot lists at gmail dot com] http://hurring.com/

« previous php.general (#236653) next »