3v4l.org

run code in 300+ PHP versions simultaneously
<?php $juices = array("apple", "orange", "koolaid1" => "purple"); echo "He drank some $juices[0] juice.".PHP_EOL; echo "He drank some $juices[1] juice.".PHP_EOL; echo "He drank some juice made of $juice[0]s.".PHP_EOL; // Не будет работать echo "He drank some $juices[koolaid1] juice.".PHP_EOL; class people { public $john = "John Smith"; public $jane = "Jane Smith"; public $robert = "Robert Paulsen"; public $smith = "Smith"; } $people = new people(); echo "$people->john drank some $juices[0] juice.".PHP_EOL; echo "$people->john then said hello to $people->jane.".PHP_EOL; echo "$people->john's wife greeted $people->robert.".PHP_EOL; echo "$people->robert greeted the two $people->smiths."; // Не будет работать ?>
Output for 8.3.0 - 8.3.4
He drank some apple juice. He drank some orange juice. Warning: Undefined variable $juice in /in/llA87 on line 6 Warning: Trying to access array offset on null in /in/llA87 on line 6 He drank some juice made of s. He drank some purple juice. John Smith drank some apple juice. John Smith then said hello to Jane Smith. John Smith's wife greeted Robert Paulsen. Warning: Undefined property: people::$smiths in /in/llA87 on line 22 Robert Paulsen greeted the two .
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17
He drank some apple juice. He drank some orange juice. Warning: Undefined variable $juice in /in/llA87 on line 6 Warning: Trying to access array offset on value of type null in /in/llA87 on line 6 He drank some juice made of s. He drank some purple juice. John Smith drank some apple juice. John Smith then said hello to Jane Smith. John Smith's wife greeted Robert Paulsen. Warning: Undefined property: people::$smiths in /in/llA87 on line 22 Robert Paulsen greeted the two .
Output for 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
He drank some apple juice. He drank some orange juice. Notice: Undefined variable: juice in /in/llA87 on line 6 Notice: Trying to access array offset on value of type null in /in/llA87 on line 6 He drank some juice made of s. He drank some purple juice. John Smith drank some apple juice. John Smith then said hello to Jane Smith. John Smith's wife greeted Robert Paulsen. Notice: Undefined property: people::$smiths in /in/llA87 on line 22 Robert Paulsen greeted the two .
Output for 5.0.2 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 7.3.32 - 7.3.33, 7.4.26
He drank some apple juice. He drank some orange juice. He drank some juice made of s. He drank some purple juice. John Smith drank some apple juice. John Smith then said hello to Jane Smith. John Smith's wife greeted Robert Paulsen. Robert Paulsen greeted the two .
Output for 5.5.0 - 5.5.35, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31
He drank some apple juice. He drank some orange juice. Notice: Undefined variable: juice in /in/llA87 on line 6 He drank some juice made of s. He drank some purple juice. John Smith drank some apple juice. John Smith then said hello to Jane Smith. John Smith's wife greeted Robert Paulsen. Notice: Undefined property: people::$smiths in /in/llA87 on line 22 Robert Paulsen greeted the two .
Output for 5.0.0 - 5.0.1
He drank some apple juice.PHP_EOLHe drank some orange juice.PHP_EOLHe drank some juice made of s.PHP_EOLHe drank some purple juice.PHP_EOLJohn Smith drank some apple juice.PHP_EOLJohn Smith then said hello to Jane Smith.PHP_EOLJohn Smith's wife greeted Robert Paulsen.PHP_EOLRobert Paulsen greeted the two .
Output for 4.4.2 - 4.4.9
<br /> <b>Parse error</b>: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in <b>/in/llA87</b> on line <b>10</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
<br /> <b>Parse error</b>: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in <b>/in/llA87</b> on line <b>10</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.4
<br /> <b>Parse error</b>: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in <b>/in/llA87</b> on line <b>10</b><br />
Process exited with code 255.

preferences:
270.9 ms | 401 KiB | 355 Q