3v4l.org

run code in 300+ PHP versions simultaneously
<?php class strtoupper_filter extends php_user_filter { function filter($in, $out, &$consumed, $closing) { while ($bucket = stream_bucket_make_writeable($in)) { $bucket->data = strtoupper($bucket->data); $consumed += $bucket->datalen; stream_bucket_append($out, $bucket); } return PSFS_PASS_ON; } } define('FD', fopen('/dev/null','rw')); stream_filter_append(FD, "strtoupper_filter");
Output for 8.3.0 - 8.3.6
Deprecated: Return type of strtoupper_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/0SvoK on line 4 Warning: fopen(): open_basedir restriction in effect. File(/dev/null) is not within the allowed path(s): (/tmp:/in:/etc) in /in/0SvoK on line 15 Warning: fopen(/dev/null): Failed to open stream: Operation not permitted in /in/0SvoK on line 15 Fatal error: Uncaught TypeError: stream_filter_append(): Argument #1 ($stream) must be of type resource, false given in /in/0SvoK:16 Stack trace: #0 /in/0SvoK(16): stream_filter_append(false, 'strtoupper_filt...') #1 {main} thrown in /in/0SvoK on line 16
Process exited with code 255.
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Deprecated: Return type of strtoupper_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/0SvoK on line 4 Warning: fopen(): open_basedir restriction in effect. File(/dev/null) is not within the allowed path(s): (/tmp:/in:/etc) in /in/0SvoK on line 15 Warning: fopen(/dev/null): Failed to open stream: Operation not permitted in /in/0SvoK on line 15 Fatal error: Uncaught TypeError: stream_filter_append(): Argument #1 ($stream) must be of type resource, bool given in /in/0SvoK:16 Stack trace: #0 /in/0SvoK(16): stream_filter_append(false, 'strtoupper_filt...') #1 {main} thrown in /in/0SvoK on line 16
Process exited with code 255.
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30
Warning: fopen(): open_basedir restriction in effect. File(/dev/null) is not within the allowed path(s): (/tmp:/in:/etc) in /in/0SvoK on line 15 Warning: fopen(/dev/null): Failed to open stream: Operation not permitted in /in/0SvoK on line 15 Fatal error: Uncaught TypeError: stream_filter_append(): Argument #1 ($stream) must be of type resource, bool given in /in/0SvoK:16 Stack trace: #0 /in/0SvoK(16): stream_filter_append(false, 'strtoupper_filt...') #1 {main} thrown in /in/0SvoK on line 16
Process exited with code 255.
Output for 8.0.13
Warning: stream_filter_append(): Unable to locate filter "strtoupper_filter" in /in/0SvoK on line 16
Output for 5.1.5 - 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.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0, 7.3.32 - 7.3.33, 7.4.33
Warning: stream_filter_append(): unable to locate filter "strtoupper_filter" in /in/0SvoK on line 16
Output for 7.3.0 - 7.3.31, 7.4.0 - 7.4.32
Warning: fopen(): open_basedir restriction in effect. File(/dev/null) is not within the allowed path(s): (/tmp:/in:/etc) in /in/0SvoK on line 15 Warning: fopen(/dev/null): failed to open stream: Operation not permitted in /in/0SvoK on line 15 Warning: stream_filter_append() expects parameter 1 to be resource, bool given in /in/0SvoK on line 16
Output for 7.1.26 - 7.1.33, 7.2.17 - 7.2.33
Warning: fopen(): open_basedir restriction in effect. File(/dev/null) is not within the allowed path(s): (/tmp:/in:/etc) in /in/0SvoK on line 15 Warning: fopen(/dev/null): failed to open stream: Operation not permitted in /in/0SvoK on line 15 Warning: stream_filter_append() expects parameter 1 to be resource, boolean given in /in/0SvoK on line 16
Output for 7.1.20, 7.2.6
Warning: fopen(): open_basedir restriction in effect. File(/dev/null) is not within the allowed path(s): (/tmp:/in) in /in/0SvoK on line 15 Warning: fopen(/dev/null): failed to open stream: Operation not permitted in /in/0SvoK on line 15 Warning: stream_filter_append() expects parameter 1 to be resource, boolean given in /in/0SvoK on line 16
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.4
Warning: stream_filter_append(): unable to create or locate filter "strtoupper_filter" in /in/0SvoK on line 16
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Fatal error: Class strtoupper_filter: Cannot inherit from undefined class php_user_filter in /in/0SvoK on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Class strtoupper_filter: Cannot inherit from undefined class php_user_filter in /in/0SvoK on line 3

preferences:
233.5 ms | 401 KiB | 343 Q