Re: list a query

From: Date: Fri, 30 Dec 2005 20:23:27 +0000
Subject: Re: list a query
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-228042@lists.php.net to get a copy of this message
On Wed, December 28, 2005 5:53 am, Ross wrote: > What does 'list' do in a php query? 'list' is kind of like an array de-constuctor. <?php $example = array(1, 2, 3); list($x, $y, $z) = $example; echo "x: $x y: $y z: $z\n\n"; ?> x: 1 y: 2 z: 3 > $result = mysql_query($query) or die('Error, query failed'); > list($name, $type, $size, $content) = mysql_fetch_array($result); $result is an array: array('Ross', 'Hosting Company', 'Comfy', 'aztechost.com'); 'list' is tearing that array apart into individual variables. -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#228042) next »