Solved! Re: initialize assoc arrays

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux