3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class A { function __construct() { var_dump(__FUNCTION__); var_dump(func_get_args()); return true; } function __destruct() { var_dump(__FUNCTION__); var_dump(func_get_args()); return true; } public function dir_closedir() { var_dump(__FUNCTION__); var_dump(func_get_args()); return true; } public function dir_opendir($path, $options) { var_dump(__FUNCTION__); var_dump(func_get_args()); return true; } public function dir_readdir() { var_dump(__FUNCTION__); var_dump(func_get_args()); return true; } public function dir_rewinddir() { var_dump(__FUNCTION__); var_dump(func_get_args()); return true; } public function mkdir($path, $mode, $options) { var_dump(__FUNCTION__); var_dump(func_get_args()); return true; } public function rename($path_from, $path_to) { var_dump(__FUNCTION__); var_dump(func_get_args()); return true; } public function rmdir($path, $options) { var_dump(__FUNCTION__); var_dump(func_get_args()); return true; } public function stream_cast($cast_as) { var_dump(__FUNCTION__); var_dump(func_get_args()); return false; } public function stream_close() { var_dump(__FUNCTION__); var_dump(func_get_args()); return true; } public function stream_eof() { var_dump(__FUNCTION__); var_dump(func_get_args()); return false; } public function stream_flush() { var_dump(__FUNCTION__); var_dump(func_get_args()); return true; } public function stream_lock($operation) { var_dump(__FUNCTION__); var_dump(func_get_args()); return true; } public function stream_metadata($path, $option, $value) { var_dump(__FUNCTION__); var_dump(func_get_args()); return true; } public function stream_open($path, $mode, $options, &$opened_path) { var_dump(__FUNCTION__); var_dump(func_get_args()); return true; } public function stream_read($count) { var_dump(__FUNCTION__); var_dump(func_get_args()); return true; } public function stream_seek($offset, $whence = SEEK_SET) { var_dump(__FUNCTION__); var_dump(func_get_args()); return true; } public function stream_set_option($option, $arg1, $arg2) { var_dump(__FUNCTION__); var_dump(func_get_args()); return true; } public function stream_stat() { var_dump(__FUNCTION__); var_dump(func_get_args()); return true; } public function stream_tell() { var_dump(__FUNCTION__); var_dump(func_get_args()); return true; } public function stream_truncate($new_size) { var_dump(__FUNCTION__); var_dump(func_get_args()); return true; } public function stream_write($data) { var_dump(__FUNCTION__); var_dump(func_get_args()); return true; } public function unlink($path) { var_dump(__FUNCTION__); var_dump(func_get_args()); return true; } public function url_stat($path, $flags) { var_dump(__FUNCTION__); var_dump(func_get_args()); return true; } } stream_wrapper_register("abc", "A") or die("Failed to register protocol"); $fp = fopen("abc://b", "rw"); feof($fp); fread($fp, 1); /** We don't have anything like stream_cast $r = array($fp); $w = null; $e = null; stream_select($r, $w, $e, 0); */ fflush($fp); flock($fp, LOCK_SH); /** No virtual method yet stream_set_blocking($fp, 1); */ fseek($fp, 123); /** No virtual method yet fstat($fp); */ ftruncate($fp, 456); fwrite($fp, 789); chmod('abc://c', 0123); unlink('abc://d'); is_file('abc://e'); is_link('abc://f'); print("*** *** ***\n"); touch('abc://g'); print("*** *** ***\n"); mkdir('abc://dir', 0755, true); rmdir('abc://dir'); rename('abc://dir', 'abc://dir2');
based on GOv9R
Output for 5.4.7 - 5.6.28, 7.0.0 - 7.1.0
string(11) "__construct" array(0) { } string(11) "stream_open" array(4) { [0]=> string(7) "abc://b" [1]=> string(2) "rw" [2]=> int(0) [3]=> NULL } string(10) "stream_eof" array(0) { } string(11) "stream_read" array(1) { [0]=> int(8192) } string(10) "stream_eof" array(0) { } string(12) "stream_flush" array(0) { } string(11) "stream_lock" array(1) { [0]=> int(1) } string(11) "stream_seek" array(2) { [0]=> int(123) [1]=> int(0) } string(11) "stream_tell" array(0) { } string(15) "stream_truncate" array(1) { [0]=> int(456) } string(12) "stream_write" array(1) { [0]=> string(3) "789" } string(12) "stream_write" array(1) { [0]=> string(2) "89" } string(12) "stream_write" array(1) { [0]=> string(1) "9" } string(11) "__construct" array(0) { } string(15) "stream_metadata" array(3) { [0]=> string(7) "abc://c" [1]=> int(6) [2]=> int(83) } string(10) "__destruct" array(0) { } string(11) "__construct" array(0) { } string(6) "unlink" array(1) { [0]=> string(7) "abc://d" } string(10) "__destruct" array(0) { } string(11) "__construct" array(0) { } string(8) "url_stat" array(2) { [0]=> string(7) "abc://e" [1]=> int(2) } string(10) "__destruct" array(0) { } string(11) "__construct" array(0) { } string(8) "url_stat" array(2) { [0]=> string(7) "abc://f" [1]=> int(3) } string(10) "__destruct" array(0) { } *** *** *** string(11) "__construct" array(0) { } string(15) "stream_metadata" array(3) { [0]=> string(7) "abc://g" [1]=> int(1) [2]=> array(0) { } } string(10) "__destruct" array(0) { } *** *** *** string(11) "__construct" array(0) { } string(5) "mkdir" array(3) { [0]=> string(9) "abc://dir" [1]=> int(493) [2]=> int(9) } string(10) "__destruct" array(0) { } string(11) "__construct" array(0) { } string(5) "rmdir" array(2) { [0]=> string(9) "abc://dir" [1]=> int(8) } string(10) "__destruct" array(0) { } string(11) "__construct" array(0) { } string(6) "rename" array(2) { [0]=> string(9) "abc://dir" [1]=> string(10) "abc://dir2" } string(10) "__destruct" array(0) { } string(10) "__destruct" array(0) { } string(12) "stream_flush" array(0) { } string(12) "stream_close" array(0) { }
Output for hhvm-3.10.0 - 3.12.0
string(11) "__construct" array(0) { } string(11) "stream_open" array(4) { [0]=> string(7) "abc://b" [1]=> string(2) "rw" [2]=> int(0) [3]=> NULL } string(10) "stream_eof" array(0) { } string(10) "stream_eof" array(0) { } string(11) "stream_read" array(1) { [0]=> int(8192) } string(12) "stream_flush" array(0) { } string(11) "stream_lock" array(1) { [0]=> int(1) } string(11) "stream_seek" array(2) { [0]=> int(123) [1]=> int(0) } string(11) "stream_tell" array(0) { } string(15) "stream_truncate" array(1) { [0]=> int(456) } string(11) "stream_seek" array(2) { [0]=> int(0) [1]=> int(1) } string(11) "stream_tell" array(0) { } string(12) "stream_write" array(1) { [0]=> string(3) "789" } string(12) "stream_write" array(1) { [0]=> string(2) "89" } string(12) "stream_write" array(1) { [0]=> string(1) "9" } string(11) "__construct" array(0) { } string(15) "stream_metadata" array(3) { [0]=> string(7) "abc://c" [1]=> int(6) [2]=> int(83) } string(10) "__destruct" array(0) { } string(11) "__construct" array(0) { } string(6) "unlink" array(1) { [0]=> string(7) "abc://d" } string(10) "__destruct" array(0) { } string(11) "__construct" array(0) { } string(8) "url_stat" array(2) { [0]=> string(7) "abc://e" [1]=> int(2) } string(10) "__destruct" array(0) { } string(11) "__construct" array(0) { } string(8) "url_stat" array(2) { [0]=> string(7) "abc://f" [1]=> int(1) } string(10) "__destruct" array(0) { } *** *** *** string(11) "__construct" array(0) { } string(15) "stream_metadata" array(3) { [0]=> string(7) "abc://g" [1]=> int(1) [2]=> array(0) { } } string(10) "__destruct" array(0) { } *** *** *** string(11) "__construct" array(0) { } string(5) "mkdir" array(3) { [0]=> string(9) "abc://dir" [1]=> int(493) [2]=> int(1) } string(10) "__destruct" array(0) { } string(11) "__construct" array(0) { } string(5) "rmdir" array(2) { [0]=> string(9) "abc://dir" [1]=> int(0) } string(10) "__destruct" array(0) { } string(11) "__construct" array(0) { } string(6) "rename" array(2) { [0]=> string(9) "abc://dir" [1]=> string(10) "abc://dir2" } string(10) "__destruct" array(0) { }
Output for 5.4.0 - 5.4.6
string(11) "__construct" array(0) { } string(11) "stream_open" array(4) { [0]=> string(7) "abc://b" [1]=> string(2) "rw" [2]=> int(0) [3]=> NULL } string(10) "stream_eof" array(0) { } string(11) "stream_read" array(1) { [0]=> int(8192) } string(10) "stream_eof" array(0) { } string(12) "stream_flush" array(0) { } string(11) "stream_lock" array(1) { [0]=> int(1) } string(11) "stream_seek" array(2) { [0]=> int(123) [1]=> int(0) } string(11) "stream_tell" array(0) { } string(15) "stream_truncate" array(1) { [0]=> int(456) } string(12) "stream_write" array(1) { [0]=> string(3) "789" } string(12) "stream_write" array(1) { [0]=> string(2) "89" } string(12) "stream_write" array(1) { [0]=> string(1) "9" } string(15) "stream_metadata" array(3) { [0]=> string(7) "abc://c" [1]=> int(6) [2]=> int(83) } string(10) "__destruct" array(0) { } string(6) "unlink" array(1) { [0]=> string(7) "abc://d" } string(10) "__destruct" array(0) { } string(8) "url_stat" array(2) { [0]=> string(7) "abc://e" [1]=> int(2) } string(10) "__destruct" array(0) { } string(8) "url_stat" array(2) { [0]=> string(7) "abc://f" [1]=> int(3) } string(10) "__destruct" array(0) { } *** *** *** string(15) "stream_metadata" array(3) { [0]=> string(7) "abc://g" [1]=> int(1) [2]=> array(0) { } } string(10) "__destruct" array(0) { } *** *** *** string(5) "mkdir" array(3) { [0]=> string(9) "abc://dir" [1]=> int(493) [2]=> int(9) } string(10) "__destruct" array(0) { } string(5) "rmdir" array(2) { [0]=> string(9) "abc://dir" [1]=> int(8) } string(10) "__destruct" array(0) { } string(6) "rename" array(2) { [0]=> string(9) "abc://dir" [1]=> string(10) "abc://dir2" } string(10) "__destruct" array(0) { } string(10) "__destruct" array(0) { } string(12) "stream_flush" array(0) { } string(12) "stream_close" array(0) { }