<?php
'a' => 0,
'b' => array( 'b1' => 5 , 'b2' => array( 'b2_0' => 4 ) , 'b3' => array( 'b3_0' => 5 ) ),
'c' => 2,
'd' => 5
);
$saida = replaceValue($seuArray, 'b2_0', 'novo_valor');
function replaceValue($array, $key, $newValue)
{
'newvalue' => $newValue,
'key' => $key
);
if ($k == $params['key']) {
$v = $params['newvalue'];
}
});
return $array;
}
PD9waHAKJHNldUFycmF5ID0gYXJyYXkoIAogICdhJyA9PiAwLAogICdiJyA9PiAgIGFycmF5KCAnYjEnID0+IDUgLCAKICAgICAgICAgICAgICAgICAgJ2IyJyA9PiBhcnJheSggJ2IyXzAnID0+IDQgKSAsCiAgICAgICAgICAgICAgICAgICdiMycgPT4gYXJyYXkoICdiM18wJyA9PiA1ICkKICAgICAgICAgICAgKSwKICAnYycgPT4gMiwKICAnZCcgPT4gNQogICk7Cgokc2FpZGEgPSByZXBsYWNlVmFsdWUoJHNldUFycmF5LCAnYjJfMCcsICdub3ZvX3ZhbG9yJyk7CgoKZnVuY3Rpb24gcmVwbGFjZVZhbHVlKCRhcnJheSwgJGtleSwgJG5ld1ZhbHVlKQp7CgogICAgJHBhcmFtcyA9IGFycmF5KAogICAgICAnbmV3dmFsdWUnID0+ICRuZXdWYWx1ZSwKICAgICAgJ2tleScgICAgICA9PiAka2V5ICAgIAogICAgKTsKCiAgICBhcnJheV93YWxrX3JlY3Vyc2l2ZSgkYXJyYXksIGZ1bmN0aW9uKCYkdiwgJGspIHVzZSAoJHBhcmFtcykgewoKICAgICAgICBpZiAoJGsgPT0gJHBhcmFtc1sna2V5J10pIHsKICAgICAgICAgICAgJHYgPSAkcGFyYW1zWyduZXd2YWx1ZSddOwogICAgICAgIH0gICAgICAgCiAgICB9KTsgCiAgICByZXR1cm4gJGFycmF5Owp9CgpwcmludF9yKCRzYWlkYSk7