3v4l.org

run code in 300+ PHP versions simultaneously
<?php class rotate_filter_nw extends php_user_filter { function filter($in, $out, &$consumed, $closing) { while ($bucket = stream_bucket_make_writeable($in)) { $this->rotate($bucket->data); $consumed += $bucket->datalen; stream_bucket_prepend($out, $bucket); } return PSFS_PASS_ON; } function rotate(&$data) { $n = strlen($data); for ($i = 0; $i < $n - 1; ++$i) { $data[$i] = $data[$i + 1]; } } } stream_filter_register("rotator_notWorking", rotate_filter_nw::class); $stream = fopen('php://memory', 'w+'); fwrite($stream, 'hello, world'); rewind($stream); stream_filter_append($stream, "rotator_notWorking"); var_dump(stream_get_contents($stream));
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of rotate_filter_nw::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/lQ88Q on line 5 string(12) "ello, worldd"

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:
137.12 ms | 406 KiB | 5 Q