Re: Passing arrays as arguments to a method
| From: | Chris Lee | Date: | Thu, 08 Feb 2001 15:31:44 +0000 |
| Subject: | Re: Passing arrays as arguments to a method | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-38766@lists.php.net to get a copy of this message | ||
Ive seen posts like this before ( 'how do I pass arrays as arguments to
functions?' ) this is quite simple, nothing at all has to be done.
<?php
class test
{
function test($array)
{
foreach($array as $pos => $val)
echo "$pos : $val <br>\n";
}
}
$arr[] = 'chris ';
$arr[] = 'lee ';
$arr[] = 'works for ';
$arr[] = 'mediawaveonline.com ';
$test = new test($arr);
?>
there's nothing to it.
--
Chris Lee
Mediawaveonline.com
lee@mediawaveonline.com
"rodrigo" <rodrigo@shreve.net> wrote in message
news:3A82DF92.9F96C6EA@shreve.net...
> Is it possible to pass arrays as arguments to class methods? If so, how?
> What is the proper syntax and things to look out for.
>
> Thanks in advanced.
> --
> ************************************
> Ivan R. Quintero E.* (507)228-3477
> Aptdo 1263 * (507)228-9105
> Balboa, Ancon * 640-0370
> Republic of Panama *
> ************************************
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>