Can I pass the first by reference and then check to see if there
is a 2nd, e.g:
procedure foo($bar){
echo $bar;
$numargs = func_num_args();
if ($numargs) {
$bar2 = func_get_arg(1);
echo $bar2;
...
}
or must I get both args using func_get_arg() or func_get_args() ?
bill
Did you try it?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstu...@attglobal.net
==================
Or even
procedure foo($bar, $bar2 = NULL){
> On 5 Nov, 14:44, bill <nob...@spamcop.net> wrote:
<snip>
> Or even
> procedure foo($bar, $bar2 = NULL){
ITYM: function foo($bar, $bar2 = NULL){
^^^^^^^^
--
Curtis Dyer
<? $x='<? $x=%c%s%c;printf($x,39,$x,39);?>';printf($x,39,$x,39);?>
function doit($a=array()){
echo 'I have '.count($a).' items!';
foreach ($a as $key => $value) {
echo "Key: $key; Value: $value<br />\n";
}
}
>have you considered passing an array?
Should always be the last option. If you just have a small number of
arguments, maybe even with some being optional, explicitly define them
like that.
Passing them all as an array not only complicates the code, but will
also interfere with many features in modern IDEs like code completion,
auto documentation and debugging.
Micha