3v4l.org

run code in 300+ PHP versions simultaneously
<?php private static function parseDateTime($value, string $format): \DateTimeImmutable { if ($value instanceof \DateTimeImmutable) { return $value; } if ($value instanceof \DateTime) { return \DateTimeImmutable::createFromMutable($value); } if (\is_numeric($value)) { return \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $value)); } if (!\is_scalar($value)) { throw new InvalidFormatException("Cannot convert non-scalar value to date/time"); } if (!$result = \DateTimeImmutable::createFromFormat($format, $value)) { throw new InvalidFormatException("Cannot parse '{$value}' as a date/time using the format '{$format}'"); } return $result; }

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)
7.2.40.0070.01219.46
7.2.30.0050.01219.50
7.2.20.0070.01119.43
7.2.10.0090.00819.32
7.2.00.0070.01019.39
7.1.160.0060.01118.06
7.1.150.0110.00618.30
7.1.140.0080.01018.42
7.1.130.0100.00618.28
7.1.120.0080.00918.26
7.1.110.0080.01017.91
7.1.100.0050.01117.82
7.1.90.0050.01117.64
7.1.80.0070.01017.55
7.1.70.0050.00917.00
7.1.60.0290.01135.03
7.1.50.0210.01434.57
7.1.40.0270.00934.25
7.1.30.0250.00934.26
7.1.20.0240.01334.30
7.1.10.0070.00816.32
7.1.00.0060.00816.29

preferences:
150.8 ms | 1175 KiB | 7 Q