3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{"language":"en","education":[{"unit":"e1","language":"en"}],"membership":[{"uei":"21","Uifed":"failed"}]}'; $arrayData = json_decode($json, true); $replacementData = array('membership' => array(array('Uifed' => 'success'))); $newArrayData = array_replace_recursive($arrayData, $replacementData); print_r($newArrayData); $replacementData = array('Uifed' => 'success'); array_walk_recursive($arrayData, function (&$value, $key) use ($replacementData) { $value = $replacementData[$key] ?? $value; }); print_r($arrayData);

preferences:
24.56 ms | 407 KiB | 5 Q