3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arrays = [ [ "id" => 1, "order_id" => 1, "image_url" => "/resources/filename1" ], [ "id" => 2, "order_id" => 1, "image_url" => "/resources/filename2" ] ]; $start = array_shift($arrays); $start['image_url'] = [$start['image_url']]; var_dump($start); $arrays = array_reduce($arrays, function($carry, $item) { $carry['image_url'][] = $item['image_url']; return $carry; }, $start); print_r($arrays);
Output for git.master_jit, git.master, rfc.property-hooks
array(3) { ["id"]=> int(1) ["order_id"]=> int(1) ["image_url"]=> array(1) { [0]=> string(20) "/resources/filename1" } } Array ( [id] => 1 [order_id] => 1 [image_url] => Array ( [0] => /resources/filename1 [1] => /resources/filename2 ) )

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:
58.55 ms | 402 KiB | 8 Q