Oops, I guess i should have been a little more clear. I'll try and outline what I mean. If i create an array consisting of key value pairs, eg, to access each element's value you use a particular key.
$cat = Array('name' => Cat, 'age' => 8, 'color' => 'brown' );
If used $cat[name] I would get 'Cat' back. If I passed this array into a function:
function print_cat ($in_cat) {
echo $cat[name];
echo $cat[age];
echo $cat[color];
}
$cat = Array('name' => Cat, 'age' => 8, 'color' => 'brown' );
print_cat($cat);
I could theoretically use this key - value system to replace the traditional
function function_name (cat_name, cat_age, cat_color) {
}
so that I could add additional parameters without disrupting code written previous to those additions. As well, the order of the parameters doesn't matter either since they are only referenced by their key.
Basically I see the benefits of this type of system, but there is reduced control over errors, and if there are flaws with the code they may be difficult to debug. All I am wondering is whether or not named parameters is something that should be avoided or if it is acceptable coding practice.