3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo implements \JsonSerializable { public function jsonSerialize() { return new self; } } var_dump(json_encode(new Foo));
Output for git.master, git.master_jit
Deprecated: Return type of Foo::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/tLMv6 on line 4
Process exited with code 139.
Output for rfc.property-hooks
Deprecated: Return type of Foo::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/tLMv6 on line 4 Fatal error: Uncaught Error: Maximum call stack size of 8306688 bytes reached. Infinite recursion? in /in/tLMv6:5 Stack trace: #0 [internal function]: Foo->jsonSerialize() #1 /in/tLMv6(9): json_encode(Object(Foo)) #2 {main} thrown in /in/tLMv6 on line 5
Process exited with code 255.

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:
34.48 ms | 407 KiB | 5 Q