3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = <<<'JSON' { "abc": 157, "efg": 1, "hij": "1", "klm": "0.00", "created_at": { "date": "2020-04-08 12:53:34.682759", "timezone_type": 3, "timezone": "UTC" }, "updated_at": { "date": "2020-04-08 12:53:34.682759", "timezone_type": 3, "timezone": "UTC" } } JSON; $arr = json_decode($json, true); function delete_key(&$arr, $key) { foreach($arr as $k => &$v) { if ( $k === $key ) { unset($arr[$k]); continue; } if ( is_array($v) ) { delete_key($v, $key); } } } delete_key($arr, 'date'); print_r(json_encode($arr, JSON_PRETTY_PRINT));

preferences:
24.09 ms | 406 KiB | 5 Q