3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SerialDateTime extends DateTime implements JsonSerializable{ public function jsonSerialize(){ return ['timestamp' => $this->getTimestamp()]; } public function __toString(){ return $this->getTimestamp(); } // TODO: Is this the best way, or is there a better way? public static function createFromFormat($f, $t, $tz=NULL){ $dateTime = call_user_func( array('SerialDateTime', 'parent::createFromFormat'), $f, $t, $tz ); $ret = new self(); return $ret->setTimestamp($dateTime->getTimestamp()); } } echo(strnatcasecmp(new SerialDateTime, new SerialDateTime('January 1, 2013'));
Output for 5.4.0 - 5.4.19
Parse error: syntax error, unexpected ';' in /in/K8COp on line 24
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected '[' in /in/K8COp on line 6
Process exited with code 255.

preferences:
176.81 ms | 1394 KiB | 55 Q