Passing an array as an argument.
| From: | April | Date: | Tue, 06 Feb 2001 17:18:15 +0000 |
| Subject: | Passing an array as an argument. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-38401@lists.php.net to get a copy of this message | ||
How do you pass an array as an argument to a function?
My code (or at least the important parts):
function process_members($asker_rank, $email) {
global $database_mysql;
mysql_select_db($database_mysql);
while (list ($key, $val) = each ($email)) {
echo "$key => $val<br>";
}
}
######### This will display fine. #########
while (list ($key, $val) = each ($email)) {
echo "$key => $val<br>";
}
######### Doing the same thing with the function here returns this error,
though. ########
// Warning: Variable passed to each() is not an array or object in lib.inc
on line 447
process_members($asker_rank, $total_members, $email);