3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Email implement 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'));
Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.30, 5.6.8 - 5.6.15
Parse error: syntax error, unexpected 'implement' (T_STRING), expecting '{' in /in/LVLYd on line 3
Process exited with code 255.

preferences:
190.4 ms | 1387 KiB | 67 Q