3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
1. <?php 2. $cast = array("william shatner", "leonard nimoy", "deforest kelley"); 3. print count($cast) . "\n"; 4. print $cast[1] . "\n"; 5. $cast[] = "James Doohan"; 6. print count($cast) . "\n"; 7. print $cast[count($cast)-1] . "\n"; 8. $cast[2] = "George Takei"; 9. $i = 1; 10. foreach($cast as $actor){ 11. print ("$i) $actor\n"); 12. $i = $i + 1; 12. } 13. ?>
Output for 5.4.0 - 5.4.23
Parse error: syntax error, unexpected '$cast' (T_VARIABLE) in /in/a5Y1H on line 2
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_VARIABLE in /in/a5Y1H on line 2
Process exited with code 255.