3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); ini_set('display_errors', true); ini_set('html_errors', false); // Simple array: $array = array(1, 2); $count = count($array); for ($i = 0; $i < $count; $i++) { echo "\nChecking $i: \n"; echo "Bad: " . $array['$i'] . "\n"; echo "Good: " . $array[$i] . "\n"; echo "Bad: {$array['$i']}\n"; echo "Good: {$array[$i]}\n"; }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Checking 0: Warning: Undefined array key "$i" in /in/ppujk on line 10 Bad: Good: 1 Warning: Undefined array key "$i" in /in/ppujk on line 12 Bad: Good: 1 Checking 1: Warning: Undefined array key "$i" in /in/ppujk on line 10 Bad: Good: 2 Warning: Undefined array key "$i" in /in/ppujk on line 12 Bad: Good: 2
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.30, 7.0.0 - 7.0.29, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Checking 0: Notice: Undefined index: $i in /in/ppujk on line 10 Bad: Good: 1 Notice: Undefined index: $i in /in/ppujk on line 12 Bad: Good: 1 Checking 1: Notice: Undefined index: $i in /in/ppujk on line 10 Bad: Good: 2 Notice: Undefined index: $i in /in/ppujk on line 12 Bad: Good: 2
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Checking 0: Notice: Undefined index: $i in /in/ppujk on line 10 Bad: Good: 1 Notice: Undefined index: $i in /in/ppujk on line 12 Bad: Good: 1 Checking 1: Notice: Undefined index: $i in /in/ppujk on line 10 Bad: Good: 2 Notice: Undefined index: $i in /in/ppujk on line 12 Bad: Good: 2

preferences:
279.59 ms | 403 KiB | 432 Q