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"); stream_filter_prepend(STDOUT, "strtoupper"); echo "abcd\n";
Output for hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
abcd
Output for 5.2.3 - 5.3.29, 5.4.1, 5.4.3, 5.4.6 - 5.4.7, 5.4.13, 5.4.29, 5.4.36, 5.4.45, 5.5.1, 5.5.15, 5.5.19, 5.5.25 - 5.5.26, 5.5.36 - 5.5.37, 5.6.6, 5.6.12, 5.6.18, 5.6.22, 5.6.28
abcd
Process exited with code 139.
Output for 5.4.0, 5.4.2, 5.4.4 - 5.4.5, 5.4.8 - 5.4.12, 5.4.14 - 5.4.28, 5.4.30 - 5.4.35, 5.4.37 - 5.4.44, 5.5.0, 5.5.2 - 5.5.14, 5.5.16 - 5.5.18, 5.5.20 - 5.5.24, 5.5.27 - 5.5.35, 5.5.38 - 5.6.5, 5.6.7 - 5.6.11, 5.6.13 - 5.6.17, 5.6.19 - 5.6.21, 5.6.23 - 5.6.25
abcd
Process exited with code 135.
Output for 5.0.0 - 5.2.2
Notice: Use of undefined constant STDOUT - assumed 'STDOUT' in /in/GHl17 on line 18 Warning: stream_filter_prepend() expects parameter 1 to be resource, string given in /in/GHl17 on line 18 abcd
Output for 4.3.2 - 4.4.9
Fatal error: Class strtoupper_filter: Cannot inherit from undefined class php_user_filter in /in/GHl17 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/GHl17 on line 3