3v4l.org

run code in 300+ PHP versions simultaneously
<?php $response = '{ "status": 1, "message": "Success", "data": [ { "order": { "id_biling": "1", "order_id": "A18", "kd_bill": "001001202101200001", "order_name": "Kita", "amount": "20000" }, "detail": [ { "kd_bill": "001001202101200001", "name": "Odading", "id_item": "66", "amount": "10000", "subtot": "20000", "jml": "2" } ] } ] }'; $decoded_response = json_decode($response, true); foreach($decoded_response['data'][0] as $key=>$value){ if ($key == 'detail'){ $decoded_response['data'][0]['order'][$key] = $value; unset($decoded_response['data'][0][$key]); } } echo json_encode($decoded_response);
Output for git.master, git.master_jit, rfc.property-hooks
{"status":1,"message":"Success","data":[{"order":{"id_biling":"1","order_id":"A18","kd_bill":"001001202101200001","order_name":"Kita","amount":"20000","detail":[{"kd_bill":"001001202101200001","name":"Odading","id_item":"66","amount":"10000","subtot":"20000","jml":"2"}]}}]}

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
144.93 ms | 406 KiB | 5 Q