Re: quicker arrays as func args?

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

 



Justin French wrote:

Hi all,

Pretty sure this can't be done, but thought I'd ask any way...

I have a function where the 3rd argument is an array..

function foo($a,$b,$c) {
    echo $a.$b;
    print_r($c);
}

Obviously the function does more than that, but anyway, I want the calls to this function to look a little cleaner than this:

foo("cat","dog",array("a"=>"1","b"=>"2","c"=>"3"));

is there any other way to define the array?

foo("cat","dog",("a"=>"1","b"=>"2","c"=>"3")); or foo("cat","dog",{"a"=>"1","b"=>"2","c"=>"3"}); would be nice (Ruby has something like this), but I'm guessing it's not possible.
nope, that's the only way

But, I'm asking just in case I've missed it in the docs.

TIA

---
Justin French, Indent.com.au
justin.french@xxxxxxxxxxxxx
Web Application Development & Graphic Design

-- 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