3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php //echo __FILE__; $fp = fopen(__FILE__, 'r'); // seek file pointer to data fseek($fp, __COMPILER_HALT_OFFSET__); file_put_contents('/tmp/abcdefghi.php', '<?php' . PHP_EOL . stream_get_contents($fp)); require_once '/tmp/abcdefghi.php'; __halt_compiler(); //echo __FILE__; var_dump(phpversion()); class Custom_StreamWrapper { public $context; public static function getPath($url, $mustExist = true) { $parts = explode('://', $url, 2); list($scheme, $path) = $parts; $path = stream_resolve_include_path($path); if (false === $path) { if ($mustExist) { throw new Exception('error'); } // centralize the stream_resolve_include_path logic return self::getPath(dirname($url)) .'/'. basename($url); } return $path; } public function stream_open($path, $mode, $options, &$openedPath) { // Modes 'a', 'c', 'w', 'x' are documented as: "If the file does not exist, attempt to create it" - so detect dir first and add filename if (in_array(substr($mode, 0, 1), array('a', 'c', 'w', 'x'))) $filepath = self::getPath($path, false); if (!isset($filepath)) $filepath = self::getPath($path); if ($options & STREAM_USE_PATH) $openedPath = $filepath; $this->_fp = fopen($filepath, $mode); return (bool)$this->_fp; } public function stream_write($data) { return fwrite($this->_fp, $data); } public function unlink($path) { return unlink(self::getPath($path)); } public function url_stat($path, $flags) { try { if ($flags & STREAM_URL_STAT_LINK) return lstat(self::getPath($path)); else return stat(self::getPath($path)); } catch (Exception $e) { if ($flags & STREAM_URL_STAT_QUIET) return false; throw $e; } } } if (!is_dir('/tmp/cache')) mkdir('/tmp/cache'); set_include_path('/tmp'); stream_wrapper_register('react', 'Custom_StreamWrapper'); file_exists('react://cache/react_unittest_filecache'); file_put_contents('react://cache/react_unittest_filecache', 'waa'); echo 'unlink'; unlink('react://cache/react_unittest_filecache'); file_exists('react://cache/react_unittest_filecache');
based on sSCDa
Output for 7.1.0
string(5) "7.1.0" unlink
Output for 7.0.14
string(6) "7.0.14" unlink
Output for 7.0.6
string(5) "7.0.6" unlink
Output for 7.0.5
string(5) "7.0.5" unlink
Output for 7.0.4
string(5) "7.0.4" unlink
Output for 7.0.3
string(5) "7.0.3" unlink
Output for 7.0.2
string(5) "7.0.2" unlink
Output for 7.0.1
string(5) "7.0.1" unlink
Output for 7.0.0
string(5) "7.0.0" unlink
Output for hhvm-3.10.0 - 3.12.0
string(11) "5.6.99-hhvm" unlink
Output for 5.6.28
string(6) "5.6.28" unlink
Output for 5.6.21
string(6) "5.6.21" unlink
Output for 5.6.20
string(6) "5.6.20" unlink
Output for 5.6.19
string(6) "5.6.19" unlink
Output for 5.6.18
string(6) "5.6.18" unlink
Output for 5.6.17
string(6) "5.6.17" unlink
Output for 5.6.16
string(6) "5.6.16" unlink
Output for 5.6.15
string(6) "5.6.15" unlink
Output for 5.6.14
string(6) "5.6.14" unlink
Output for 5.6.13
string(6) "5.6.13" unlink
Output for 5.6.12
string(6) "5.6.12" unlink
Output for 5.6.11
string(6) "5.6.11" unlink
Output for 5.6.10
string(6) "5.6.10" unlink
Output for 5.6.9
string(5) "5.6.9" unlink
Output for 5.6.8
string(5) "5.6.8" unlink
Output for 5.6.7
string(5) "5.6.7" unlink
Output for 5.5.35
string(6) "5.5.35" unlink
Output for 5.5.34
string(6) "5.5.34" unlink
Output for 5.5.33
string(6) "5.5.33" unlink
Output for 5.5.32
string(6) "5.5.32" unlink
Output for 5.5.31
string(6) "5.5.31" unlink
Output for 5.5.30
string(6) "5.5.30" unlink
Output for 5.5.29
string(6) "5.5.29" unlink
Output for 5.5.28
string(6) "5.5.28" unlink
Output for 5.5.27
string(6) "5.5.27" unlink
Output for 5.5.26
string(6) "5.5.26" unlink
Output for 5.5.25
string(6) "5.5.25" unlink
Output for 5.5.24
string(6) "5.5.24" unlink
Output for 5.4.45
string(6) "5.4.45" unlink
Output for 5.4.44
string(6) "5.4.44" unlink
Output for 5.4.43
string(6) "5.4.43" unlink
Output for 5.4.42
string(6) "5.4.42" unlink
Output for 5.4.41
string(6) "5.4.41" unlink
Output for 5.4.40
string(6) "5.4.40" unlink
Output for 5.4.39
string(6) "5.4.39" unlink
Output for 5.4.38
string(6) "5.4.38" unlink
Output for 5.4.37
string(6) "5.4.37" unlink
Output for 5.4.36
string(6) "5.4.36" unlink
Output for 5.4.35
string(6) "5.4.35" unlink
Output for 5.4.34
string(6) "5.4.34" unlink
Output for 5.4.32
string(6) "5.4.32" unlink
Output for 5.4.31
string(6) "5.4.31" unlink
Output for 5.4.30
string(6) "5.4.30" unlink
Output for 5.4.29
string(6) "5.4.29" unlink
Output for 5.4.28
string(6) "5.4.28" unlink
Output for 5.4.27
string(6) "5.4.27" unlink
Output for 5.4.26
string(6) "5.4.26" unlink
Output for 5.4.25
string(6) "5.4.25" unlink
Output for 5.4.24
string(6) "5.4.24" unlink
Output for 5.4.23
string(6) "5.4.23" unlink
Output for 5.4.22
string(6) "5.4.22" unlink
Output for 5.4.21
string(6) "5.4.21" unlink
Output for 5.4.20
string(6) "5.4.20" unlink
Output for 5.4.19
string(6) "5.4.19" unlink
Output for 5.4.18
string(6) "5.4.18" unlink
Output for 5.4.17
string(6) "5.4.17" unlink
Output for 5.4.16
string(6) "5.4.16" unlink
Output for 5.4.15
string(6) "5.4.15" unlink
Output for 5.4.14
string(6) "5.4.14" unlink
Output for 5.4.13
string(6) "5.4.13" unlink
Output for 5.4.12
string(6) "5.4.12" unlink
Output for 5.4.11
string(6) "5.4.11" unlink
Output for 5.4.10
string(6) "5.4.10" unlink
Output for 5.4.9
string(5) "5.4.9" unlink
Output for 5.4.8
string(5) "5.4.8" unlink
Output for 5.4.7
string(5) "5.4.7" unlink
Output for 5.4.6
string(5) "5.4.6" unlink
Output for 5.4.5
string(5) "5.4.5" unlink
Output for 5.4.4
string(5) "5.4.4" unlink
Output for 5.4.3
string(5) "5.4.3" unlink
Output for 5.4.2
string(5) "5.4.2" unlink
Output for 5.4.1
string(5) "5.4.1" unlink
Output for 5.4.0
string(5) "5.4.0" unlink
Output for 5.3.29
string(6) "5.3.29" unlink
Output for 5.3.28
string(6) "5.3.28" unlink
Output for 5.3.27
string(6) "5.3.27" unlink
Output for 5.3.26
string(6) "5.3.26" unlink
Output for 5.3.25
string(6) "5.3.25" unlink
Output for 5.3.24
string(6) "5.3.24" unlink
Output for 5.3.23
string(6) "5.3.23" unlink
Output for 5.3.22
string(6) "5.3.22" unlink
Output for 5.3.21
string(6) "5.3.21" unlink
Output for 5.3.20
string(6) "5.3.20" unlink
Output for 5.3.19
string(6) "5.3.19" unlink
Output for 5.3.18
string(6) "5.3.18" unlink
Output for 5.3.17
string(6) "5.3.17" unlink
Output for 5.3.16
string(6) "5.3.16" unlink
Output for 5.3.15
string(6) "5.3.15" unlink
Output for 5.3.14
string(6) "5.3.14" unlink
Output for 5.3.13
string(6) "5.3.13" unlink
Output for 5.3.12
string(6) "5.3.12" unlink
Output for 5.3.11
string(6) "5.3.11" unlink
Output for 5.3.10
string(6) "5.3.10" unlink
Output for 5.3.9
string(5) "5.3.9" unlink
Output for 5.3.8
string(5) "5.3.8" unlink
Output for 5.3.7
string(5) "5.3.7" unlink
Output for 5.3.6
string(5) "5.3.6" unlink
Output for 5.3.5
string(5) "5.3.5" unlink
Output for 5.3.4
string(5) "5.3.4" unlink
Output for 5.3.3
string(5) "5.3.3" unlink
Output for 5.3.2
string(5) "5.3.2" unlink
Output for 5.3.1
string(5) "5.3.1" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.3.0
string(5) "5.3.0" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.2.17
string(6) "5.2.17" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.2.16
string(6) "5.2.16" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.2.15
string(6) "5.2.15" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.2.14
string(6) "5.2.14" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.2.13
string(6) "5.2.13" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.2.12
string(6) "5.2.12" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.2.11
string(6) "5.2.11" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.2.10
string(6) "5.2.10" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.2.9
string(5) "5.2.9" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.2.8
string(5) "5.2.8" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.2.7
string(5) "5.2.7" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.2.6
string(5) "5.2.6" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.2.5
string(5) "5.2.5" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.2.4
string(5) "5.2.4" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.2.3
string(5) "5.2.3" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.2.2
string(5) "5.2.2" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.2.1
string(5) "5.2.1" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.2.0
string(5) "5.2.0" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.1.6
string(5) "5.1.6" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.1.5
string(5) "5.1.5" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.1.4
string(5) "5.1.4" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.1.3
string(5) "5.1.3" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.1.2
string(5) "5.1.2" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.1.1
string(5) "5.1.1" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.1.0
string(5) "5.1.0" Fatal error: Call to undefined function stream_resolve_include_path() in /tmp/abcdefghi.php on line 17
Process exited with code 255.
Output for 5.0.2 - 5.0.5
Notice: Use of undefined constant __COMPILER_HALT_OFFSET__ - assumed '__COMPILER_HALT_OFFSET__' in /in/ng4K1 on line 8 Parse error: parse error, unexpected '<' in /tmp/abcdefghi.php on line 2
Process exited with code 255.
Output for 5.0.0 - 5.0.1
Notice: Use of undefined constant __COMPILER_HALT_OFFSET__ - assumed '__COMPILER_HALT_OFFSET__' in /in/ng4K1 on line 8 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ng4K1 on line 10 <?phpPHP_EOL Notice: Use of undefined constant __COMPILER_HALT_OFFSET__ - assumed '__COMPILER_HALT_OFFSET__' in /tmp/abcdefghi.php on line 8 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /tmp/abcdefghi.php on line 10 Fatal error: Call to undefined function __halt_compiler() in /tmp/abcdefghi.php on line 13
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/ng4K1 on line 20
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/ng4K1 on line 20
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/ng4K1 on line 20
Process exited with code 255.