3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ 'section-name' => ['sec1'], 'item-name' => ['1','2'], 'item-price' => ['1'], 'item-desc' => ['1','2','3'] ]; // take this out. it doesn't belong. $section = array_shift($data); $items = array_map( function($name, $price, $desc) { return ['name'=>$name, 'price'=>$price, 'desc'=>$desc]; }, ...array_values($data) ); var_dump($items);
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [0]=> array(3) { ["name"]=> string(1) "1" ["price"]=> string(1) "1" ["desc"]=> string(1) "1" } [1]=> array(3) { ["name"]=> string(1) "2" ["price"]=> NULL ["desc"]=> string(1) "2" } [2]=> array(3) { ["name"]=> NULL ["price"]=> NULL ["desc"]=> string(1) "3" } }

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:
182.98 ms | 406 KiB | 5 Q