3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo 'bug'; // Should be transformed by filter on second include if (!class_exists(SampleFilter::class)) { class SampleFilter extends php_user_filter { private $data = ''; public function filter($in, $out, &$consumed, $closing) { while ($bucket = stream_bucket_make_writeable($in)) { $this->data .= $bucket->data; } if ($closing || feof($this->stream)) { $consumed = strlen($this->data); $this->data = str_replace('bug', 'feature', $this->data); $bucket = stream_bucket_new($this->stream, $this->data); stream_bucket_append($out, $bucket); return PSFS_PASS_ON; } return PSFS_FEED_ME; } } stream_filter_register('sample.filter', SampleFilter::class); $uri = 'php://filter/read=sample.filter/resource='. __FILE__; $content = file_get_contents($uri); echo '<pre>', htmlentities($content), '</pre>'; // Looks good include $uri; // We expect one more "feature" output at line 3 }
Output for git.master, git.master_jit, rfc.property-hooks
bug Deprecated: Return type of SampleFilter::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/jEMEE on line 10 <pre>&lt;?php echo &#039;feature&#039;; // Should be transformed by filter on second include if (!class_exists(SampleFilter::class)) { class SampleFilter extends php_user_filter { private $data = &#039;&#039;; public function filter($in, $out, &amp;$consumed, $closing) { while ($bucket = stream_bucket_make_writeable($in)) { $this-&gt;data .= $bucket-&gt;data; } if ($closing || feof($this-&gt;stream)) { $consumed = strlen($this-&gt;data); $this-&gt;data = str_replace(&#039;feature&#039;, &#039;feature&#039;, $this-&gt;data); $bucket = stream_bucket_new($this-&gt;stream, $this-&gt;data); stream_bucket_append($out, $bucket); return PSFS_PASS_ON; } return PSFS_FEED_ME; } } stream_filter_register(&#039;sample.filter&#039;, SampleFilter::class); $uri = &#039;php://filter/read=sample.filter/resource=&#039;. __FILE__; $content = file_get_contents($uri); echo &#039;&lt;pre&gt;&#039;, htmlentities($content), &#039;&lt;/pre&gt;&#039;; // Looks good include $uri; // We expect one more &quot;feature&quot; output at line 3 }</pre>feature

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:
63.77 ms | 405 KiB | 8 Q