I was thinking about passing an array at first. But because of bloated handling of correct type of each argument in the array I use an object for passing additional "setting" variables.
Von meinem iPhone gesendet Am 15.10.2010 um 19:28 schrieb "Michael Shadle" <mike...@gmail.com>: > On Fri, Oct 15, 2010 at 10:26 AM, G M <greg...@gregory.net> wrote: >> Okay so I am thinking about submitting a patch to PHP that would enable you >> to call functions like this: >> >> stuff(1, 2, 'separator' => '<br>', 'clean' => true); > > I don't like having the never ending growing list of arguments issue, > but I just use > > function foo($args = array()) { > > # first pass to normalize, check, scrub data > > $bar = isset($args['whatever']) ? intval($args['whatever']) : 0; > > # second pass to do sanity checking or business logic... > > if($bar > 0) { > ... > } > > } > > Looks like Drupal 7 is taking this approach with some things too. > > I am not sure the language itself needs anything to change, it can be > done today and seems like an additional feature to shortcut something > already available. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php