думал через Foreach в foreach, но не пашет
foreach ($arr as $val) {
foreach ($val['items'] as $item) {
// хватаем item_code, например: $item['item_code']
}
}
<?php
$search_key = 'test_key';
$test_arr = array(
$search_key => 'data',
'inner' => array(
'key' => 'value',
'cities' => array(
'Moscow',
'Minsk',
'Kiev',
),
$search_key => 'second_data',
),
);
array_walk_recursive($test_arr, function (&$item, $key) use ($search_key) {
if ($key == $search_key) {
$item = 'changed';
}
});
print_r($test_arr);
$postdata = file_get_contents("php://input");