array_walk_recursive pass by reference
| From: | kranthi | Date: | Sun, 29 Aug 2010 04:35:29 +0000 |
| Subject: | array_walk_recursive pass by reference | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-307732@lists.php.net to get a copy of this message | ||
i have an array
$parms = array('1' => 'a', 'b' => array(3 =>
'test'));
i want $mail = '1:a 3:test';
array_walk_recursive($parms, function($val, $key, &$mail) {
$mail .= ucwords($key) . ': '. ucwords($val) . "\n";
}, &$mail);
The above function worked perfectly well
but i am getting: Call-time pass-by-reference has been deprecated in
/var/www/html/test.php on line 31
if i change it to
array_walk_recursive($parms, function($val, $key, &$mail) {
$mail .= ucwords($key) . ': '. ucwords($val) . "\n";
}, $mail);
i am not getting the error but $mail is not being returned.
ny solution ?
Regards
KK