3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Parser { private $chunkSize; private $buffer = ''; private $callback; public function __construct($chunkSize) { $this->chunkSize = $chunkSize; } public function onChunk($callback) { $this->callback = $callback; } public function parse($data) { $this->buffer .= $data; while (strlen($this->buffer) >= $this->chunkSize) { $chunk = (string)substr($this->buffer, 0, $this->chunkSize); $this->buffer = (string)substr($this->buffer, $this->chunkSize); call_user_func($this->callback, $chunk); } } } $p = new Parser(43); $p->onChunk(function($data) { echo "Got chunk of data: {$data}\n"; }); $p->parse('The quick brown fox jumps over the lazy dogThe quick brown fox'); $p->parse(' jum'); $p->parse('ps'); $p->parse(' over the lazy dogThe quick brown fox jumps '); $p->parse('over the lazy dog');
Output for git.master, git.master_jit, rfc.property-hooks
Got chunk of data: The quick brown fox jumps over the lazy dog Got chunk of data: The quick brown fox jumps over the lazy dog Got chunk of data: The quick brown fox jumps over the lazy dog

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:
42.12 ms | 401 KiB | 8 Q