3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $colors = array( 'red', 'green' ); $color=""; $j=0; foreach($colors as $color) { while($j <6) { if($j>1) $value = $value."($j)"; $color[]=$value; $j++; } } print_r($color);
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: [] operator not supported for strings in /in/QTJlJ:11 Stack trace: #0 {main} thrown in /in/QTJlJ on line 11
Process exited with code 255.
Output for hhvm-3.12.0 - 3.13.2
Notice: Undefined variable: value in /in/QTJlJ on line 11 Fatal error: Uncaught Error: [] operator not supported for strings in /in/QTJlJ:11 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.0.4 - 5.0.5, hhvm-3.10.0
Notice: Undefined variable: value in /in/QTJlJ on line 11 Fatal error: [] operator not supported for strings in /in/QTJlJ on line 11
Process exited with code 255.
Output for 5.1.0 - 5.6.28
Fatal error: [] operator not supported for strings in /in/QTJlJ on line 11
Process exited with code 255.
Output for 4.3.2 - 5.0.3
Notice: Undefined variable: value in /in/QTJlJ on line 11 Fatal error: [] operator not supported for strings in /in/QTJlJ on line 11
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Undefined variable: value in /in/QTJlJ on line 11 Fatal error: [] operator not supported for strings in /in/QTJlJ on line 11