3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Email implements JsonSerializable { private $value; public function __construct(string $value) { $this->value = $value; } public function jsonSerialize() { return $this->value; } } $email = new Email('opexus@gmail.com'); echo json_encode(compact('email'));

preferences:
59.26 ms | 402 KiB | 5 Q