3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { public $bar = 'baz'; } $foo = new foo; $array = array('key' => 'value'); echo <<<EOL ${array['key']} ${foo->bar} EOL; ?>
Output for 8.2.10 - 8.2.18, 8.3.0 - 8.3.7
Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /in/ettKK on line 8 Deprecated: Using ${expr} (variable variables) in strings is deprecated, use {${expr}} instead in /in/ettKK on line 8 Fatal error: Uncaught Error: Undefined constant "foo" in /in/ettKK:9 Stack trace: #0 {main} thrown in /in/ettKK on line 9
Process exited with code 255.
Output for 8.1.23 - 8.1.28
Fatal error: Uncaught Error: Undefined constant "foo" in /in/ettKK:9 Stack trace: #0 {main} thrown in /in/ettKK on line 9
Process exited with code 255.
Output for 5.4.0 - 5.4.17
Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in /in/LI0IX on line 9
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/LI0IX on line 9
Process exited with code 255.

preferences:
81.98 ms | 401 KiB | 74 Q