3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class AbstractEvent { protected $id; private $hidden; } class Event extends AbstractEvent implements JsonSerializable { private $value; public function jsonSerialize() { return get_object_vars(); } } $e = new Event(); echo json_encode($e);
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Deprecated: Return type of Event::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/4eb9N on line 14 Fatal error: Uncaught ArgumentCountError: get_object_vars() expects exactly 1 argument, 0 given in /in/4eb9N:16 Stack trace: #0 /in/4eb9N(16): get_object_vars() #1 [internal function]: Event->jsonSerialize() #2 /in/4eb9N(21): json_encode(Object(Event)) #3 {main} thrown in /in/4eb9N on line 16
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Deprecated: Return type of Event::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/4eb9N on line 14 Fatal error: Uncaught ArgumentCountError: get_object_vars() expects exactly 1 argument, 0 given in /in/4eb9N:16 Stack trace: #0 /in/4eb9N(16): get_object_vars() #1 [internal function]: Event->jsonSerialize() #2 /in/4eb9N(21): json_encode(Object(Event)) #3 {main} thrown in /in/4eb9N on line 16
Process exited with code 255.
Output for 8.0.0 - 8.0.30
Fatal error: Uncaught ArgumentCountError: get_object_vars() expects exactly 1 argument, 0 given in /in/4eb9N:16 Stack trace: #0 /in/4eb9N(16): get_object_vars() #1 [internal function]: Event->jsonSerialize() #2 /in/4eb9N(21): json_encode(Object(Event)) #3 {main} thrown in /in/4eb9N on line 16
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
Warning: get_object_vars() expects exactly 1 parameter, 0 given in /in/4eb9N on line 16 null

preferences:
210.89 ms | 403 KiB | 268 Q