Re: associative array syntax question

From: Date: Thu, 04 Oct 2001 00:24:09 +0000
Subject: Re: associative array syntax question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-69850@lists.php.net to get a copy of this message
Hi Job. This works for me (and *should* always work) : $a = array('foo' => 'bar'); $b = array('b' => 'foo'); print $a[$b['b']]; // prints bar How _exactly_ are you calling it? (provide a short standalone ex) Does the above example work for you? What version of php? regards, Philip Olson On Wed, 3 Oct 2001, Job Miller wrote: > why does: print $a[$b['b']] return: > > parse error, expecting T_STRING' or T_VARIABLE' or > `T_NUM_STRING' > > but if I do it in two steps like: > > $c=$b['b']; > print $a[$c]; > > it works fine. > > I have tried dozens of syntax combinations using > quotes, no quotes, on one or both and can't get > anything to work. any help would be greatly > appreciated. The two step method is annoying. > > Job > > > __________________________________________________ > Do You Yahoo!? > NEW from Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. > http://geocities.yahoo.com/ps/info1 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#69850) next »