3v4l.org

run code in 300+ PHP versions simultaneously
<?php $old = array( 20 => array( 'name' => 'Heels', 'path' => '10/15/20', ), 15 => array( 'name' => 'Sandals', 'path' => '15', ), 10 => array( 'name' => 'Trainers', 'path' => '10', ), ); $result = []; $mapper = array_combine(array_keys($old), array_column($old, 'name')); foreach ($old as $key => $value) { $path = implode(' > ', array_map(function($x) use ($mapper) { return $mapper[(int)$x]; }, explode('/', $value['path']))); $result[$key] = ['value' => $key,'label' => $path]; } print_r($result);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [20] => Array ( [value] => 20 [label] => Trainers > Sandals > Heels ) [15] => Array ( [value] => 15 [label] => Sandals ) [10] => Array ( [value] => 10 [label] => Trainers ) )

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