3v4l.org

run code in 300+ PHP versions simultaneously
<?php class sf extends php_user_filter { function onCreate() { //var_dump($this); } function filter($in, $out, &$consumed, $closing) { //var_dump(func_get_args()); if(!$closing) { $bucket = stream_bucket_make_writeable($in); $bucket->data = 'A'.$bucket->data.'B'; $consumed += $bucket->datalen; stream_bucket_prepend($out, $bucket); return PSFS_PASS_ON; } else { return PSFS_FEED_ME; } } } $r = fopen('php://memory', 'wb+'); stream_filter_register('sf', 'sf' ); stream_filter_append($r, 'sf', STREAM_FILTER_READ); fwrite($r, 'lol'); rewind($r); var_dump(fread($r, 1)); echo fread($r, 2);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of sf::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/0pA5M on line 8 Deprecated: Return type of sf::onCreate() should either be compatible with php_user_filter::onCreate(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/0pA5M on line 5 string(1) "A" lo

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:
65.38 ms | 402 KiB | 8 Q