3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = '[ { "id": 1, "content": "Reason 1" }, { "id": 2, "content": "Reason 2" }, { "id": 3, "content": "Reason 3" }, { "id": 4, "content": "Reason 4" } ]'; $from = json_decode($content, true); $to = json_encode(array_column($from, 'content', 'id'), JSON_PRETTY_PRINT); echo $to;

preferences:
25.88 ms | 406 KiB | 5 Q