Re: Passing arrays to functions
| From: | Jeff | Date: | Tue, 01 Aug 2000 08:10:15 +0000 |
| Subject: | Re: Passing arrays to functions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-9380@lists.php.net to get a copy of this message | ||
I tried that but all the elements in $something were
empty inside the function. For now I'll assume I screwed up
something else and try it again...
Jeff
Soeren Staun-Pedersen wrote:
>
> On Tue, 1 Aug 2000, Jeff wrote:
>
> > Can I pass an array as an argument to a function?
> >
> > The function call <? echo foo($bar[]) ?> works fine, but
> > the function declaration function foo($bar[]) gives
> > a compile time error in php3 - "expected )".
> >
> > Someone please tell me what I did wrong.
>
> function foo($something)
> {
> echo gettype($something);
>
> }
>
> $a = array(1,2,3,4);
>
> foo($a);
>
> ->"array"
>
> Soeren Staun-Pedersen - staun@netwarriors.org
> ------
> "The internet is full, beat it"
> - Me.