3v4l.org

run code in 500+ PHP versions simultaneously
<?php $json = '[{"id":"331","file_name":"3b1379e2496408dd4c865f5f63f96bf6","file_path":"https://path/3b1379e2496408dd4c865f5f63f96bf6.png"}, {"id":"332","file_name":"d0ef559473a061086592bceed0880a01","file_path":"https://path/d0ef559473a061086592bceed0880a01.png"}]'; $arr = json_decode($json, true); $output = []; foreach ($arr as $item) { $output[] = ["url" => $item["file_path"]]; } echo json_encode($output);
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
[{"url":"https:\/\/path\/3b1379e2496408dd4c865f5f63f96bf6.png"},{"url":"https:\/\/path\/d0ef559473a061086592bceed0880a01.png"}]

preferences:
59.74 ms | 1116 KiB | 4 Q