On 2/24/2011 3:01 AM, Dave M G wrote:
> PHP users,
> I obviously don't understand what array_walk_recursive does.
> Can someone break down in simple terms why the following doesn't work?
> - - -
> $karamohOutput['test'] = "";
> function test_print($item, $key)
> return "$key holds $item\n";
> $karamohOutput['test'] .= array_walk_recursive($karamohArray, 'test_print');
> - - -
> Any advice would be much appreciated.
if you read the following page description of the function, you will see that
the function returns a bool value. Not the return statement of your custom
If you read the Note under the funcname section, you will see that when you call
the function, it will pass the value as a reference, so, change around your
function like this.
$karamohOutput['test'] = "";
# notice this .....>|
function test_print(&$item, $key)
$item = "$key holds $item\n";
Give this a try and let us know.
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php