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; } } stream_filter_register("strtoupper", "strtoupper_filter") or die("Failed to register filter"); define('FD', fopen('/dev/null','rw')); stream_filter_append(FD, "strtoupper");
Output for 8.3.0 - 8.3.14, 8.4.1
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/4iYJC 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/4iYJC on line 18 Warning: fopen(/dev/null): Failed to open stream: Operation not permitted in /in/4iYJC on line 18 Fatal error: Uncaught TypeError: stream_filter_append(): Argument #1 ($stream) must be of type resource, false given in /in/4iYJC:19 Stack trace: #0 /in/4iYJC(19): stream_filter_append(false, 'strtoupper') #1 {main} thrown in /in/4iYJC on line 19
Process exited with code 255.
Output for 8.1.0 - 8.1.31, 8.2.0 - 8.2.26
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/4iYJC 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/4iYJC on line 18 Warning: fopen(/dev/null): Failed to open stream: Operation not permitted in /in/4iYJC on line 18 Fatal error: Uncaught TypeError: stream_filter_append(): Argument #1 ($stream) must be of type resource, bool given in /in/4iYJC:19 Stack trace: #0 /in/4iYJC(19): stream_filter_append(false, 'strtoupper') #1 {main} thrown in /in/4iYJC on line 19
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/4iYJC on line 18 Warning: fopen(/dev/null): Failed to open stream: Operation not permitted in /in/4iYJC on line 18 Fatal error: Uncaught TypeError: stream_filter_append(): Argument #1 ($stream) must be of type resource, bool given in /in/4iYJC:19 Stack trace: #0 /in/4iYJC(19): stream_filter_append(false, 'strtoupper') #1 {main} thrown in /in/4iYJC on line 19
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.7, 7.3.32 - 7.3.33, 7.4.26, 7.4.33, 8.0.13
Output for 7.3.0 - 7.3.31, 7.4.0 - 7.4.25, 7.4.27 - 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/4iYJC on line 18 Warning: fopen(/dev/null): failed to open stream: Operation not permitted in /in/4iYJC on line 18 Warning: stream_filter_append() expects parameter 1 to be resource, bool given in /in/4iYJC on line 19
Output for 7.1.25 - 7.1.33, 7.2.0 - 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/4iYJC on line 18 Warning: fopen(/dev/null): failed to open stream: Operation not permitted in /in/4iYJC on line 18 Warning: stream_filter_append() expects parameter 1 to be resource, boolean given in /in/4iYJC on line 19
Output for 7.1.20
Warning: fopen(): open_basedir restriction in effect. File(/dev/null) is not within the allowed path(s): (/tmp:/in) in /in/4iYJC on line 18 Warning: fopen(/dev/null): failed to open stream: Operation not permitted in /in/4iYJC on line 18 Warning: stream_filter_append() expects parameter 1 to be resource, boolean given in /in/4iYJC on line 19
Output for 5.4.0 - 5.4.35, 5.4.37 - 5.4.45, 5.5.0 - 5.5.8, 5.5.10 - 5.5.18, 5.5.20 - 5.5.25, 5.5.27 - 5.5.30, 5.5.32, 5.5.34 - 5.5.35, 5.6.0 - 5.6.2, 5.6.4 - 5.6.5, 5.6.7 - 5.6.28

Process exited with code 135.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.36, 5.5.9, 5.5.19, 5.5.26, 5.5.31, 5.5.33, 5.5.36, 5.6.3, 5.6.6

Process exited with code 139.
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/4iYJC 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/4iYJC on line 3

preferences:
96.9 ms | 418 KiB | 5 Q