3v4l.org

run code in 300+ PHP versions simultaneously
<?php $items = array( array( array("Color" => "Blue"), array("Size" => "S") ), array( array("Color" => "Blue"), array("Size" => "M") ) ); $new_items = array_map(function ($item) { $seed = array(); return array_reduce($item, function ($seed, $value) { return array_map(function ($value) { $seed[] = $value; }, $key_values); return $seed; }, array()); }, $items); var_dump($new_items);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $key_values in /in/K5IDA on line 18 Fatal error: Uncaught TypeError: array_map(): Argument #2 ($array) must be of type array, null given in /in/K5IDA:16 Stack trace: #0 /in/K5IDA(16): array_map(Object(Closure), NULL) #1 [internal function]: {closure}(Array, Array) #2 /in/K5IDA(15): array_reduce(Array, Object(Closure), Array) #3 [internal function]: {closure}(Array) #4 /in/K5IDA(12): array_map(Object(Closure), Array) #5 {main} thrown in /in/K5IDA on line 16
Process exited with code 255.

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:
65.89 ms | 401 KiB | 8 Q