I've a dynamically generated very huge array called $test_package_data
. For your understanding I'm giving below the contents of array $test_package_data
.
Now what I want to achieve is convert the value of an array key
$test_duration = ConvertTimeStampToTimeFormate($some_key['test_duration']);
In short I want to update the value of a key ['test_duration']
eveywhere in the array. But not understanding how should I loop over the array and achieve the desired result.
You can use
array_walk_recursive()
and adjust a value if the key matches'test_duration'
:You can loop over
$test_package_data['category_detail'][0]['test_detail']
. So code will be something like,Although
array_walk_recursive
is the best, but this should also work.