3v4l.org

run code in 300+ PHP versions simultaneously
<?php <?php /** * This file is part of the Nette Framework (http://nette.org) * * Copyright (c) 2004 David Grudl (http://davidgrudl.com) * * For the full copyright and license information, please view * the file license.txt that was distributed with this source code. */ namespace Nette; use Nette; /** * DateTime. * * @author David Grudl */ class DateTime extends \DateTime { /** minute in seconds */ const MINUTE = 60; /** hour in seconds */ const HOUR = 3600; /** day in seconds */ const DAY = 86400; /** week in seconds */ const WEEK = 604800; /** average month in seconds */ const MONTH = 2629800; /** average year in seconds */ const YEAR = 31557600; /** * DateTime object factory. * @param string|int|\DateTime * @return DateTime */ public static function from($time) { if ($time instanceof \DateTime || $time instanceof \DateTimeInterface) { return new static($time->format('Y-m-d H:i:s'), $time->getTimezone()); } elseif (is_numeric($time)) { if ($time <= self::YEAR) { $time += time(); } $d = new static; return $d->setTimestamp($time); } else { // textual or NULL return new static($time); } } public function __toString() { return $this->format('Y-m-d H:i:s'); } public function modifyClone($modify = '') { $dolly = clone $this; return $modify ? $dolly->modify($modify) : $dolly; } public function setTimestamp($timestamp) { $zone = $this->getTimezone(); $this->__construct('@' . $timestamp); return $this->setTimeZone($zone); } } var_dump((string) Nette\DateTime::from(2544000000));

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.230.0070.04012.38
5.4.220.0100.03912.38
5.4.210.0110.04812.38
5.4.200.0070.04412.38
5.4.190.0100.03912.37
5.4.180.0090.04012.37
5.4.170.0080.04012.38
5.4.160.0090.04912.37
5.4.150.0110.03812.37
5.4.140.0100.03912.06
5.4.130.0090.04012.04
5.4.120.0100.04112.01
5.4.110.0090.04212.00
5.4.100.0100.04812.01
5.4.90.0090.04112.01
5.4.80.0150.05612.00
5.4.70.0110.03912.00
5.4.60.0110.03712.00
5.4.50.0070.04112.00
5.4.40.0090.03611.99
5.4.30.0110.04011.98
5.4.20.0090.04011.98
5.4.10.0160.05411.99
5.4.00.0090.04111.48
5.3.280.0100.04012.71
5.3.270.0110.04412.72
5.3.260.0090.04612.72
5.3.250.0100.04612.72
5.3.240.0140.05012.72
5.3.230.0080.04412.71
5.3.220.0100.04112.68
5.3.210.0140.04812.68
5.3.200.0100.04212.68
5.3.190.0110.04212.68
5.3.180.0120.03812.67
5.3.170.0100.03912.67
5.3.160.0100.03912.67
5.3.150.0150.04912.67
5.3.140.0110.04312.66
5.3.130.0110.04212.66
5.3.120.0080.04312.66
5.3.110.0100.04112.66
5.3.100.0100.04912.12
5.3.90.0100.03712.08
5.3.80.0080.04112.08
5.3.70.0080.04212.08
5.3.60.0110.04112.07
5.3.50.0080.04112.00
5.3.40.0170.05512.00
5.3.30.0130.03511.94
5.3.20.0090.03911.72
5.3.10.0130.03511.69
5.3.00.0090.03911.67

preferences:
133.59 ms | 1394 KiB | 7 Q