3v4l.org

run code in 300+ PHP versions simultaneously
<?php class JsonResponse { const DEFAULT_ENCODING_OPTIONS = 15; protected $encodingOptions = self::DEFAULT_ENCODING_OPTIONS; public function __construct($data = null) { $data = json_encode($data, $this->encodingOptions); } } class JsonSerializableObject implements \JsonSerializable { public function jsonSerialize() { throw new \Exception('This error is expected'); } } $serializable = new JsonSerializableObject(); new JsonResponse($serializable);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of JsonSerializableObject::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/nAFVh on line 16 Fatal error: Uncaught Exception: This error is expected in /in/nAFVh:18 Stack trace: #0 [internal function]: JsonSerializableObject->jsonSerialize() #1 /in/nAFVh(10): json_encode(Object(JsonSerializableObject), 15) #2 /in/nAFVh(23): JsonResponse->__construct(Object(JsonSerializableObject)) #3 {main} thrown in /in/nAFVh on line 18
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:
73.55 ms | 402 KiB | 8 Q