You are here: quicker arrays as func args? « PHP « IT news, forums, messages
quicker arrays as func args?

Posted by Justin French on 10/04/11 11:06

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.

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

TIA

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация