Re: arrays in function definition possible?

From: Date: Wed, 27 Dec 2000 07:33:40 +0000
Subject: Re: arrays in function definition possible?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-31932@lists.php.net to get a copy of this message
try this: function useArray($foo=array(0=>3,1=>4)) { } you'd need to call it with: useArray(array(0=>3,1=>4)); or useArray(array(3,4)); Jenny Koozer wrote: > > Why won't this work? > > function useArray($foo[0]=3,$foo[1]=4) > { > > } > > I get a parse error : expecting `')'' > > Can array info be passed into a function definition > like this? I am able to call the function like this > okay : > > useArray($foo[0]=3,$foo[1]=4); > > But defining defaults this way seems impossible. This > is strange to me, please explain! My "workaround" is > to define $foo array and make $foo global but ... > > TIA! > > __________________________________________________ > Do You Yahoo!? > Yahoo! Shopping - Thousands of Stores. Millions of Products. > http://shopping.yahoo.com/ > > -- > 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 (#31932) next »