3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SerialDateTime extends DateTime implements JsonSerializable{ public function jsonSerialize(){ return $this->getTimestamp(); } } class StringDateTime extends DateTime{ public function __toString(){ return ''.$this->getTimestamp(); } } $j = new SerialDateTime; $s = new StringDateTime; //echo $j."\n"; echo $s."\n"; echo json_encode(array($j, $s));
Output for git.master
Deprecated: Return type of SerialDateTime::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/FaXks on line 5 1378912524 [1378912524,{"date":"2013-09-11 17:15:24.003662","timezone_type":3,"timezone":"Europe\/Amsterdam"}]
Output for git.master_jit
Deprecated: Return type of SerialDateTime::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/FaXks on line 5 1378912524 [1378912524,{"date":"2013-09-11 17:15:24.003756","timezone_type":3,"timezone":"Europe\/Amsterdam"}]
Output for rfc.property-hooks
Deprecated: Return type of SerialDateTime::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/FaXks on line 5 1378912524 [1378912524,{"date":"2013-09-11 17:15:24.003926","timezone_type":3,"timezone":"Europe\/Amsterdam"}]

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:
38.8 ms | 401 KiB | 8 Q