3v4l.org

run code in 300+ PHP versions simultaneously
<?php class user_filter extends php_user_filter { function filter($in, $out, &$consumed, $closing) { while($bucket = stream_bucket_make_writeable($in)) { } fclose($this->stream); } } stream_filter_register('user_filter','user_filter'); $fd = fopen('php://memory','w'); $filter = stream_filter_append($fd, 'user_filter'); echo fwrite($fd, "foo");
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Deprecated: Return type of user_filter::filter($in, $out, &$consumed, $closing) should either be compatible with php_user_filter::filter($in, $out, &$consumed, bool $closing): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/bjaEh on line 3 Warning: fclose(): 5 is not a valid stream resource in /in/bjaEh on line 6 Fatal error: Uncaught TypeError: fclose(): supplied resource is not a valid stream resource in /in/bjaEh:6 Stack trace: #0 /in/bjaEh(6): fclose(Resource id #5) #1 [internal function]: user_filter->filter(Resource id #10, Resource id #11, 0, true) #2 {main} thrown in /in/bjaEh on line 6
Process exited with code 255.
Output for 8.0.13 - 8.0.30
Warning: fclose(): 5 is not a valid stream resource in /in/bjaEh on line 6 Fatal error: Uncaught TypeError: fclose(): supplied resource is not a valid stream resource in /in/bjaEh:6 Stack trace: #0 /in/bjaEh(6): fclose(Resource id #5) #1 [internal function]: user_filter->filter(Resource id #12, Resource id #13, 0, true) #2 {main} thrown in /in/bjaEh on line 6
Process exited with code 255.
Output for 7.4.0 - 7.4.25, 8.0.0 - 8.0.12
Output for 7.4.26 - 7.4.33
Warning: fclose(): 5 is not a valid stream resource in /in/bjaEh on line 6 Warning: fclose(): supplied resource is not a valid stream resource in /in/bjaEh on line 6
Output for 7.0.14 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.12 - 7.3.33
0
Output for 7.0.11
139786646384880
Output for 7.0.10
140459517604080
Output for 7.0.9
140666699337968
Output for 7.0.8
140163412218096
Output for 7.0.7
140654829457648
Output for 7.0.6
140412736327920
Output for 7.0.5
139665699328240
Output for 7.0.4
139859696374000
Output for 7.0.3
139694663094512
Output for 7.0.2
139750805950704
Output for 7.0.1
140333113757936
Output for 7.0.0
140413715697904
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28

Process exited with code 139.
Output for 5.2.3 - 5.2.17, 5.3.0 - 5.3.29
Warning: fclose(): 5 is not a valid stream resource in /in/bjaEh on line 6 0
Output for 5.1.4 - 5.1.6, 5.2.0 - 5.2.2
Warning: fclose(): 2 is not a valid stream resource in /in/bjaEh on line 6 0
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.3
Warning: fopen(php://memory): failed to open stream: Inappropriate ioctl for device in /in/bjaEh on line 10 Warning: stream_filter_append() expects parameter 1 to be resource, boolean given in /in/bjaEh on line 11 Warning: fwrite(): supplied argument is not a valid stream resource in /in/bjaEh on line 12
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Fatal error: Class user_filter: Cannot inherit from undefined class php_user_filter in /in/bjaEh on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Class user_filter: Cannot inherit from undefined class php_user_filter in /in/bjaEh on line 2

preferences:
235.53 ms | 401 KiB | 356 Q