3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C implements JsonSerializable { var $a = 'lol'; var $b = 'fa'; public function jsonSerialize() { $aux = clone($this); unset($aux->a); return $aux; } } echo json_encode(new C());
Output for 8.1rc2
Deprecated: Return type of C::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/TSgMV on line 7
Process exited with code 139.
Output for 8.1rc1
Deprecated: Return type of C::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/TSgMV on line 7
Process exited with code 139.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.30, 7.2.0 - 7.2.33, 7.3.0 - 7.3.30, 7.4.0 - 7.4.23, 8.0.0 - 8.0.10

Process exited with code 139.
Output for 5.3.0 - 5.3.29
Fatal error: Interface 'JsonSerializable' not found in /in/TSgMV on line 4
Process exited with code 255.

preferences:
64.82 ms | 462 KiB | 5 Q