3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 5.5.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
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.2 - 5.4.45
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.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.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.