3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $file = __DIR__.'/file.txt'; file_put_contents($file, '<?php return 1;'); $var = include $file; file_put_contents($file, '<?php return 2;'); $var = include $file; var_dump($var);
Output for 5.6.28, 7.0.14 - 7.1.0
Warning: file_put_contents(/in/file.txt): failed to open stream: Permission denied in /in/7GlU6 on line 3 Warning: include(/in/file.txt): failed to open stream: No such file or directory in /in/7GlU6 on line 4 Warning: include(): Failed opening '/in/file.txt' for inclusion (include_path='.:') in /in/7GlU6 on line 4 Warning: file_put_contents(/in/file.txt): failed to open stream: Permission denied in /in/7GlU6 on line 5 Warning: include(/in/file.txt): failed to open stream: No such file or directory in /in/7GlU6 on line 6 Warning: include(): Failed opening '/in/file.txt' for inclusion (include_path='.:') in /in/7GlU6 on line 6 bool(false)
Output for 5.3.0 - 5.6.25, 7.0.0 - 7.0.10
Warning: file_put_contents(/in/file.txt): failed to open stream: Read-only file system in /in/7GlU6 on line 3 Warning: include(/in/file.txt): failed to open stream: No such file or directory in /in/7GlU6 on line 4 Warning: include(): Failed opening '/in/file.txt' for inclusion (include_path='.:') in /in/7GlU6 on line 4 Warning: file_put_contents(/in/file.txt): failed to open stream: Read-only file system in /in/7GlU6 on line 5 Warning: include(/in/file.txt): failed to open stream: No such file or directory in /in/7GlU6 on line 6 Warning: include(): Failed opening '/in/file.txt' for inclusion (include_path='.:') in /in/7GlU6 on line 6 bool(false)
Output for hhvm-3.10.0 - 3.12.0
Warning: Read-only file system in /in/7GlU6 on line 3 Warning: File not found: /in/file.txt in /in/7GlU6 on line 4 Warning: Read-only file system in /in/7GlU6 on line 5 Warning: File not found: /in/file.txt in /in/7GlU6 on line 6 bool(false)
Output for 5.1.0 - 5.2.17
Notice: Use of undefined constant __DIR__ - assumed '__DIR__' in /in/7GlU6 on line 2 Warning: file_put_contents(__DIR__/file.txt): failed to open stream: No such file or directory in /in/7GlU6 on line 3 Warning: include(__DIR__/file.txt): failed to open stream: No such file or directory in /in/7GlU6 on line 4 Warning: include(): Failed opening '__DIR__/file.txt' for inclusion (include_path='.:') in /in/7GlU6 on line 4 Warning: file_put_contents(__DIR__/file.txt): failed to open stream: No such file or directory in /in/7GlU6 on line 5 Warning: include(__DIR__/file.txt): failed to open stream: No such file or directory in /in/7GlU6 on line 6 Warning: include(): Failed opening '__DIR__/file.txt' for inclusion (include_path='.:') in /in/7GlU6 on line 6 bool(false)
Output for 5.0.0 - 5.0.5
Notice: Use of undefined constant __DIR__ - assumed '__DIR__' in /in/7GlU6 on line 2 Warning: file_put_contents(__DIR__/file.txt): failed to open stream: No such file or directory in /in/7GlU6 on line 3 Warning: main(__DIR__/file.txt): failed to open stream: No such file or directory in /in/7GlU6 on line 4 Warning: main(): Failed opening '__DIR__/file.txt' for inclusion (include_path='.:') in /in/7GlU6 on line 4 Warning: file_put_contents(__DIR__/file.txt): failed to open stream: No such file or directory in /in/7GlU6 on line 5 Warning: main(__DIR__/file.txt): failed to open stream: No such file or directory in /in/7GlU6 on line 6 Warning: main(): Failed opening '__DIR__/file.txt' for inclusion (include_path='.:') in /in/7GlU6 on line 6 bool(false)
Output for 4.4.5 - 4.4.9
Notice: Use of undefined constant __DIR__ - assumed '__DIR__' in /in/7GlU6 on line 2 Fatal error: Call to undefined function: file_put_contents() in /in/7GlU6 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Notice: Use of undefined constant __DIR__ - assumed '__DIR__' in /in/7GlU6 on line 2 Fatal error: Call to undefined function: file_put_contents() in /in/7GlU6 on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Use of undefined constant __DIR__ - assumed '__DIR__' in /in/7GlU6 on line 2 Fatal error: Call to undefined function: file_put_contents() in /in/7GlU6 on line 3