3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = ['a'=>1,'b'=>2,'c'=>3]; var_dump(array_reduce($a, function($result, $item) use ($a) { $key = $result ? key($result) : $a; $key = $key == 'a' ? 'aa' : $key; $result[$key] = $item; return $result; }));
Output for git.master, git.master_jit
Fatal error: Uncaught TypeError: Illegal offset type in /in/lME2K:7 Stack trace: #0 [internal function]: {closure}(Array, 1) #1 /in/lME2K(4): array_reduce(Array, Object(Closure)) #2 {main} thrown in /in/lME2K on line 7
Process exited with code 255.
Output for rfc.property-hooks
Fatal error: Uncaught TypeError: Cannot access offset of type array on array in /in/lME2K:7 Stack trace: #0 [internal function]: {closure}(Array, 1) #1 /in/lME2K(4): array_reduce(Array, Object(Closure)) #2 {main} thrown in /in/lME2K on line 7
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:
50.19 ms | 401 KiB | 8 Q