Solved! Re: initialize assoc arrays
| From: | Charles Kline | Date: | Mon, 31 Mar 2003 23:21:59 +0000 |
| Subject: | Solved! Re: initialize assoc arrays | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-26769@lists.php.net to get a copy of this message | ||
Hey. I just figured it out! So simple too :)
$myarray = array();
foreach ($sth_opt as $thekey => $thevalue){
$myarray[$thevalue] = true;
}
On Monday, March 31, 2003, at 06:05 PM, Charles Kline wrote:
hi all, i am changing the title are reposting - i have a clearer idea now of what i am trying to do... what is the syntax to initialize an associative array with values returned in a query where the key in the array is coming from the query and the value is static value of true? i want to create an array that 'could' look like this: $myarray = array('31'=>true,'21'=>true); where 31 and 21 are the values returned from query thanks, charles -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php