Re: Creating associative array

From: Date: Wed, 05 Feb 2003 13:01:22 +0000
Subject: Re: Creating associative array
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-134397@lists.php.net to get a copy of this message
On Wednesday 05 February 2003 20:51, Chris Hayes wrote: > At 13:28 5-2-03, you wrote: > >Try: > >$image_array = array(); > >$image_array[$file_name] = $image_url; > > > >PHP wrote: > >>I am trying to create associative array in a while loop.. > >> > >>$image_array = array(); $image_array = > >>array_push("$file_name"=>"$image_url"); > > i agree with the suggestion, but maybe (this may be a stupid newbie > comment) this will also work, if you insist on using array_push: > > $image_array = array_push(array("$file_name"=>"$image_url")); Please read the manual. array_push() does NOT work like that. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* And in the heartbreak years that lie ahead, Be true to yourself and the Grateful Dead. -- Joan Baez */

« previous php.general (#134397) next »