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'; //var_dump($bucket, $closing); /*while ($bucket = stream_bucket_make_writeable($in)) { */ $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, 1024)); //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/k3HWj 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/k3HWj on line 5 array(4) { [0]=> resource(7) of type (userfilter.bucket brigade) [1]=> resource(8) of type (userfilter.bucket brigade) [2]=> NULL [3]=> bool(false) } array(4) { [0]=> resource(10) of type (userfilter.bucket brigade) [1]=> resource(11) of type (userfilter.bucket brigade) [2]=> NULL [3]=> bool(true) } string(5) "AlolB"

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:
53.21 ms | 403 KiB | 8 Q