array_walk_recursive pass by reference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux