Re: how to alter assoc_array?

From: Date: Sat, 10 Feb 2001 19:58:04 +0000
Subject: Re: how to alter assoc_array?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-39095@lists.php.net to get a copy of this message
jason, thanks ... got it. while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ list($key, $value) = each($row); $key_new="X.$key"; $value_new="X.$value"; $new_array=array($key_new => $value_new"); } thanks, jaxon On 2/10/01 2:32 PM, "jason cox" <mr_jasoncox@yahoo.com> wrote: > I would just loop through the array and grab the > key/value pairs and then add them to a new array as > you modify them. > > Jason > --- Jaxon <jaxon@salamander.net> wrote: >> Hi folks! >> >> If $array contains the following: >> >> boy => hello >> girl => hi >> dog => bark >> >> How can I alter all the elements the same way? >> >> e.g. so that it now conatins: >> >> Xboy => Xhello >> Xgirl => Xhi >> Xdog => Xbark >> >> thanks! >> jaxon >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, e-mail: >> php-general-unsubscribe@lists.php.net >> For additional commands, e-mail: >> php-general-help@lists.php.net >> To contact the list administrators, e-mail: > php-list-admin@lists.php.net > > > __________________________________________________ > Do You Yahoo!? > Get personalized email addresses from Yahoo! Mail - only $35 > a year! http://personal.mail.yahoo.com/

« previous php.general (#39095) next »