Re: default function argument issue

From: AJ (harryman100_at_hotmail.com)
Date: 03/22/04


Date: Mon, 22 Mar 2004 18:47:10 +0000 (UTC)

On 22 Mar 2004 10:39:39 -0800, Brad Kent <bkfake-google@yahoo.com> wrote:

> function test($foo=array()) {
> echo gettype($foo);
> implode(' ',$foo);
> }
>
> foo();
>
>
>
> This code will output:
> null
>
> and generate the error
> Bad arguments. in .... on line x ( bad implode args )
>
> what's the deal?
> $foo should be an array!

I guess its because $foo doesn't have anything in it, I think even if
something is an array, but only has one element in it, it will fail an
implode.



Relevant Pages