Level 35
$output = array_pluck($input, 'price', 'id');
// actual output:
echo json_encode($output);
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello!
I want to convert this

into this

with pure PHP. How can I do that? The only thing that is confusing me is how to reformat the array. The request to the API and the response handling is something I can do. But I want to format the response to the exact same way as the first photo. Any ideas?
Please or to participate in this conversation.