3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Intercept extends php_user_filter { public static $cache = ''; public function filter($in, $out, &$consumed, $closing) { while ($bucket = stream_bucket_make_writeable($in)) { self::$cache .= $bucket->data; $consumed += $bucket->datalen; stream_bucket_append($out, $bucket); } return PSFS_PASS_ON; } } $out = fwrite(STDOUT, "Hello\n"); var_dump($out); stream_filter_register("intercept_filter", "Intercept"); stream_filter_append(STDOUT, "intercept_filter"); $out = fwrite(STDOUT, "Goodbye\n"); var_dump($out);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of Intercept::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/fMHZu on line 6 Hello int(6) Goodbye int(8)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
20.43 ms | 402 KiB | 8 Q