Re: asociative array syntax

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

 



Merlin wrote:
I would like to associate to 2 variables the same content.
Example:

'gm_GM', 'gm_CH' => array(

unfortunatelly this syntax does not work. It simply overwrites gm_GM
Any ideas on how to make this possible?

'gm_GM' is not overwritten, do a print_r($array) to verify. What you're telling PHP to do is to add a secuential index whose value is 'gm_GM', then an asociative index 'gm_CH' whose value is an array.

	If you want to assign the same value to both index, you need to simply do
  'gm_GM' => $value,
  'gm_CH' => $value,
or
  $array['gm_GM'] = $array['gm_CH'] = $value;
--
Atentamente,
J. Rafael Salazar Magaña
Innox - Innovación Inteligente
Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE
http://www.innox.com.mx

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux