Re: array as parameter
| From: | Hardy Merrill | Date: | Thu, 16 Nov 2000 16:02:40 +0000 |
| Subject: | Re: array as parameter | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-25711@lists.php.net to get a copy of this message | ||
Juan Pacheco [jpacheco@lidti.unsa.edu.ar] wrote:
> There is a way to pass an array as parameter of php function??
> how?
Here's the way that I've been passing arrays into functions - pass
the array by reference(be aware that when using pass-by-reference,
changes to the "referenced" variable in the function are actually
made to that variable):
function abc(&$arr_var) {
foreach ($arr_var as $v) {
echo "\$v = $v";
}
}
$xyz_array = array("a", "b", "c");
abc($xyz_array);
But there are other ways to pass arguments to functions. Read the
documentation on www.php.net under
http://www.php.net/manual/html/functions.arguments.html
HTH.
--
Hardy Merrill
Mission Critical Linux, Inc.
http://www.missioncriticallinux.com