I using array recursive to find leaf. My function is working, I easy printing value from leaf. Now i trying get value out of function, i need use this for another function. This is my code.
$nazwa;
function testArrayItem($item, $key)
{
if($key== "values")
{
$nazwa=$item;
}
}
array_walk_recursive($des1['values']['0'], 'testArrayItem');
echo $nazwa;
My varible "$nazwa" is empty how i can get value from my function? Thx for help