3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array('id' => 1, 'name' => 'Fred'); $result = array_map_assoc( function ($key, $value) { return $value; }, $arr ); $result2 = array_map_assoc( function ($key, $value, $value2) { return "$value2 ($key: $value)"; }, $arr, [ 'Foo', 'Bar', ] ); var_dump($result, $result2); function array_map_assoc(callable $callback, array $array, array ...$arrays) { $keys = array_keys($array); array_unshift($arrays, $keys, $array); return array_combine($keys, array_map($callback, ...$arrays)); }
Output for git.master_jit, git.master, rfc.property-hooks
array(2) { ["id"]=> int(1) ["name"]=> string(4) "Fred" } array(2) { ["id"]=> string(11) "Foo (id: 1)" ["name"]=> string(16) "Bar (name: Fred)" }

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:
54.23 ms | 405 KiB | 5 Q