Array key names - can they be called as strings?

From: Date: Thu, 17 Jul 2003 21:38:21 +0000
Subject: Array key names - can they be called as strings?
Groups: php.general 
Request: Send a blank email to php-general+get-155683@lists.php.net to get a copy of this message
Perhaps I was not that clear on the subject :) I have the following array: $SAVEVARS[headerimage]=$_POST[headerimage]; $SAVEVARS[backgroundimage]=$_POST[backgroundimage]; I want to iterate through it to save to a database config: Forach($SAVEVARS as $whatever) { $query="update table set $whatever=$whatever[$whatever]"; } Where the 'set $whatever' would become 'set headerimage' and '=$whatever[$whatever]' would become the value that was posted through and set on the line above. The question is the - the assigned string key - is there a way to retrieve that in a loop? Foreach, for, while or otherwise? -- Cheers Mike Morton **************************************************** * * Tel: 905-465-1263 * Email: mike@webtraxx.com * **************************************************** "Indeed, it would not be an exaggeration to describe the history of the computer industry for the past decade as a massive effort to keep up with Apple." - Byte Magazine Given infinite time, 100 monkeys could type out the complete works of Shakespeare. Win 98 source code? Eight monkeys, five minutes. -- NullGrey

« previous php.general (#155683) next »