3v4l.org

run code in 300+ PHP versions simultaneously
<?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 8.3.0 - 8.3.6
Warning: Trying to access array offset on null in /in/igcV5 on line 28 My name is "Example of string spanning multiple lines using heredoc syntax.". I am printing some . Now, I am printing some . This should print a capital 'A': A
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Warning: Trying to access array offset on value of type null in /in/igcV5 on line 28 My name is "Example of string spanning multiple lines using heredoc syntax.". I am printing some . Now, I am printing some . This should print a capital 'A': A
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.6 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
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.3.11, 4.4.0 - 4.4.9, 5.1.3 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.3.32 - 7.3.33
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.0.5, 5.1.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

preferences:
230.54 ms | 402 KiB | 342 Q