3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 7.0.0 - 7.1.0
Output for hhvm-3.10.0 - 3.12.0
Warning: Constants may only evaluate to scalar values in /in/4iYJC on line 18 Notice: Use of undefined constant FD - assumed 'FD' in /in/4iYJC on line 19 Warning: stream_filter_append() expects parameter 1 to be resource, string given in /in/4iYJC on line 19
Output for 5.4.0 - 5.4.35, 5.4.37 - 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.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.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