3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('America/Los_Angeles'); class Fruit { public $type = 'Apple', $lastEaten = null; public function __construct() { $this->lastEaten = new DateTime(); } public function jsonSerialize() { return array( 'type' => $this->type, 'lastEaten' => $this->lastEaten->format(DateTime::ISO8601) ); } } echo $s = json_encode(new Fruit()); var_dump(json_decode($s));
Output for git.master
{"type":"Apple","lastEaten":{"date":"2013-08-20 13:51:44.003796","timezone_type":3,"timezone":"America\/Los_Angeles"}}object(stdClass)#1 (2) { ["type"]=> string(5) "Apple" ["lastEaten"]=> object(stdClass)#2 (3) { ["date"]=> string(26) "2013-08-20 13:51:44.003796" ["timezone_type"]=> int(3) ["timezone"]=> string(19) "America/Los_Angeles" } }
Output for git.master_jit
{"type":"Apple","lastEaten":{"date":"2013-08-20 13:51:44.004071","timezone_type":3,"timezone":"America\/Los_Angeles"}}object(stdClass)#1 (2) { ["type"]=> string(5) "Apple" ["lastEaten"]=> object(stdClass)#2 (3) { ["date"]=> string(26) "2013-08-20 13:51:44.004071" ["timezone_type"]=> int(3) ["timezone"]=> string(19) "America/Los_Angeles" } }
Output for rfc.property-hooks
{"type":"Apple","lastEaten":{"date":"2013-08-20 13:51:44.003856","timezone_type":3,"timezone":"America\/Los_Angeles"}}object(stdClass)#1 (2) { ["type"]=> string(5) "Apple" ["lastEaten"]=> object(stdClass)#2 (3) { ["date"]=> string(26) "2013-08-20 13:51:44.003856" ["timezone_type"]=> int(3) ["timezone"]=> string(19) "America/Los_Angeles" } }

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:
51.58 ms | 402 KiB | 8 Q