Re: asociative array syntax
| From: | Rafael | Date: | Fri, 21 Apr 2006 14:30:50 +0000 |
| Subject: | Re: asociative array syntax | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-234493@lists.php.net to get a copy of this message | ||
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