3v4l.org

run code in 300+ PHP versions simultaneously
<?php $select['clientChoice'] = '{"23" : {"13x18":"5","20X30":"5","30x45":"4","digital":"4"}}'; $clientChoice = array(42 => array("13x18" => 2, "20X30" => 1, "30x45" =>3 , "digital" => 1)); $tabs = json_decode($select['clientChoice'], true); print_r($tabs); $new = array_merge($tabs, $clientChoice); print_r($new); $new = $tabs + $clientChoice; print_r($new); $chosen = json_encode($new);

preferences:
24.08 ms | 407 KiB | 5 Q