3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SerialDateTime extends DateTime implements JsonSerializable{ public function jsonSerialize(){ return ['timestamp' => $this->getTimestamp()]; } public static function createFromFormat($x,$y,$z=NULL){ $a = call_user_func_array(array(__CLASS__ , 'parent::'.__FUNCTION__), func_get_args()); $b = new self(); return $b->setTimestamp($a->getTimestamp()); } } echo json_encode([SerialDateTime::createFromFormat('m/d/Y', '10/31/2011')]);

preferences:
32.48 ms | 402 KiB | 5 Q