3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $str = <<<EOD Example of string spanning multiple lines using heredoc syntax. EOD; /* More complex example, with variables. */ class foo { var $foo; var $bar; function foo() { $this->foo = 'Foo'; $this->bar = array('Bar1', 'Bar2', 'Bar3'); } } $foo = new foo(); $name = 'MyName'; echo <<<EOT My name is "$str". I am printing some $foo->foo. Now, I am printing some {$foo->bar[1]}. This should print a capital 'A': \x41 EOT; ?>
Output for 7.0.0 - 7.1.0
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; foo has a deprecated constructor in /in/igcV5 on line 11 My name is "Example of string spanning multiple lines using heredoc syntax.". I am printing some Foo. Now, I am printing some Bar2. This should print a capital 'A': A
Output for 4.3.0 - 4.4.9, 5.1.3 - 5.6.28, hhvm-3.10.0 - 3.12.0
My name is "Example of string spanning multiple lines using heredoc syntax.". I am printing some Foo. Now, I am printing some Bar2. This should print a capital 'A': A
Output for 5.1.2
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/igcV5 on line 14 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/igcV5 on line 15 My name is "Example of string spanning multiple lines using heredoc syntax.". I am printing some Foo. Now, I am printing some Bar2. This should print a capital 'A': A
Output for 5.0.0 - 5.1.1
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/igcV5 on line 13 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/igcV5 on line 14 My name is "Example of string spanning multiple lines using heredoc syntax.". I am printing some Foo. Now, I am printing some Bar2. This should print a capital 'A': A