note 63811 deleted from function.func-get-args by peehaa

From: Date: Mon, 08 Apr 2019 06:11:21 +0000
Subject: note 63811 deleted from function.func-get-args by peehaa
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-210547@lists.php.net to get a copy of this message
Note Submitter: bew ---- A more concise way of expressing my idea from the previous post (I'd forgotten about array_slice()): <?php function func_get_default_args($a) { $args = array_slice(func_get_args(), 1); return array_merge($args, array_slice($a, sizeof($args))); } function foo($a = 1, $b = 2, $c = 3) { print_r(func_get_default_args(func_get_args(), $a, $b, $c)); } // prints: Array ( [0] => a [1] => b [2] => 3 ) foo('a', 'b'); ?>

« previous php.notes (#210547) next »