3v4l.org

run code in 300+ PHP versions simultaneously
<?php function generator() { yield '1' => 4; yield '0' => 2; } $array = [...generator()]; echo implode(',', $array);
Output for 7.4.0 - 7.4.11, 8.0.0alpha1 - rc2
Fatal error: Uncaught Error: Cannot unpack Traversable with string keys in /in/qKGPt:8 Stack trace: #0 {main} thrown in /in/qKGPt on line 8
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.23
Parse error: syntax error, unexpected '...' (T_ELLIPSIS), expecting ']' in /in/qKGPt on line 8
Process exited with code 255.