Can't test it now, but have you tried

function makeyogurt ($flavour, $type = list())

I assume you need it to be an array because you want to either walk it or, more
likely, perform an in_array() test on it and you found that passing non-array
variables to in_array issues an error. If initializing as an array doesn't work
you can always do this:

function makeyogurt ($flavour, $type = "") {
  while ((is_array($type)) && (list($key,$val)=each($type)))
  {
    [loop]
  }
}

or this:

function makeyogurt ($flavour, $type = "") {
  if ((is_array($type)) && (in_array("strawberry_yoghurt",$type)))
  {
    [loop]
  }
}

or use the stone-age method:

function makeyogurt ($flavour, $type = "") {
  if (@in_array("strawberry_yoghurt",$type))
  {
    [loop]
  }
}

Bogdan

Michael Jurgens wrote:

> Hi,
>
> As you all may know, this is how you set an optional second argument, that
> defaults to acidophilus
>
> function makeyogurt ($flavour, $type = "acidophilus")
> { }
>
> I'm now looking for a way to have the second (optional) argument be an array
> of strings. I can't get it to work though...
>
> In pseudo-code:
>
> function makeyogurt ($flavour, $type = 'EMPTY ARRAY')
> { }
>
> Any help would be much appreciated,
> Michael
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to