3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test implements \JsonSerializable { private $test; public function __construct(int $test) { $this->test = $test; } public function getTest(): int { return $this->test; } public function jsonSerialize(): array { $clone = new \stdClass; $clone->test = $this->getTest(); return (array) $clone; } } $testClass = new Test(1); $stdClass = new \stdClass; $stdClass->test = 1; $testClassEncode = json_encode($testClass); $stdClassEncode = json_encode((array) $stdClass); var_dump($testClassEncode, $stdClassEncode);
Output for rfc.property-hooks, git.master, git.master_jit
string(10) "{"test":1}" string(10) "{"test":1}"

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:
48.04 ms | 1449 KiB | 4 Q