3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface DateFormatParser { /** * @param $string * * @return DateTime */ public function parse($string); } abstract class PregDateParser implements DateFormatParser { protected $pattern, $format, $mask; public function parse($string) { $string = (string)$string; $pattern = $this->pattern; $format = $this->format; $mask = $this->mask; $r = preg_match($pattern, $string, $matches); if (!$r) { throw new UnexpectedValueException('Preg Regex Pattern failed.'); } $buffer = vsprintf($mask, $matches); $result = DateTime::createFromFormat($format, $buffer); if (!$result) { throw new UnexpectedValueException(sprintf('Failed To Create from Format "%s" for "%s".', $format, $buffer)); } return $result; } } class JsonTimestampWithOffsetParser extends PregDateParser { protected $pattern = '/^\/Date\((\d{10})(\d{3})([+-]\d{4})\)\/$/'; protected $format = 'U.u.O'; protected $mask = '%2$s.%3$s.%4$s'; } $date = '/Date(1440960660000-0200)/'; $parser = new JsonTimestampWithOffsetParser; $dt = $parser->parse($date); //$dt->modify(); $timezoneShift = $dt->format('Z'); $timezoneShift = ($timezoneShift > 0) ? '+' . $timezoneShift : '-' . $timezoneShift; echo $dt->modify($timezoneShift)->format('Y-m-d H:i:s');

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)
8.3.60.0070.00717.25
8.3.50.0070.00716.93
8.3.40.0060.00919.42
8.3.30.0140.00719.57
8.3.20.0080.00020.52
8.3.10.0090.00023.96
8.3.00.0080.00023.73
8.2.180.0140.00417.25
8.2.170.0110.00422.96
8.2.160.0120.00322.68
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0000.00826.16
8.2.120.0040.00418.25
8.2.110.0040.01419.46
8.2.100.0040.00718.13
8.2.90.0040.00419.43
8.2.80.0060.00318.25
8.2.70.0060.00318.25
8.2.60.0040.00418.18
8.2.50.0000.00818.13
8.2.40.0000.00821.50
8.2.30.0030.00618.39
8.2.20.0040.00418.29
8.2.10.0000.00718.58
8.2.00.0020.00518.43
8.1.280.0140.00425.92
8.1.270.0060.00320.62
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0060.00324.09
8.1.230.0120.00018.16
8.1.220.0040.00418.16
8.1.210.0000.00818.77
8.1.200.0140.00017.98
8.1.190.0040.00417.98
8.1.180.0000.00818.10
8.1.170.0100.00019.12
8.1.160.0000.00822.28
8.1.150.0070.00019.20
8.1.140.0000.00818.27
8.1.130.0040.00418.04
8.1.120.0020.00518.14
8.1.110.0000.00817.96
8.1.100.0000.00818.12
8.1.90.0040.00418.04
8.1.80.0000.00718.04
8.1.70.0000.00718.11
8.1.60.0060.00318.10
8.1.50.0040.00418.06
8.1.40.0030.00618.13
8.1.30.0000.00818.11
8.1.20.0060.00318.18
8.1.10.0040.00418.14
8.1.00.0060.00318.14
8.0.300.0060.00318.77
8.0.290.0000.00717.50
8.0.280.0000.00718.78
8.0.270.0070.00017.77
8.0.260.0030.00317.56
8.0.250.0000.00717.55
8.0.240.0000.00717.61
8.0.230.0080.00017.50
8.0.220.0000.00717.70
8.0.210.0050.00317.57
8.0.200.0050.00317.64
8.0.190.0030.00517.66
8.0.180.0090.00017.58
8.0.170.0040.00417.56
8.0.160.0000.00717.49
8.0.150.0030.00517.45
8.0.140.0000.00717.49
8.0.130.0040.00413.95
8.0.120.0000.01017.53
8.0.110.0000.00717.57
8.0.100.0040.00417.52
8.0.90.0040.00417.71
8.0.80.0060.01617.39
8.0.70.0000.00817.42
8.0.60.0040.00417.71
8.0.50.0000.00717.52
8.0.30.0050.01317.74
8.0.20.0110.01417.47
8.0.10.0040.00417.57
8.0.00.0130.00617.27
7.4.330.0050.00015.59
7.4.320.0000.00717.22
7.4.300.0000.00617.28
7.4.290.0000.00717.13
7.4.280.0040.00417.30
7.4.270.0000.00717.31
7.4.260.0070.00017.05
7.4.250.0040.00417.09
7.4.240.0060.00217.14
7.4.230.0000.00717.29
7.4.220.0040.01417.09
7.4.210.0110.00517.15
7.4.200.0000.00717.08
7.4.160.0120.00617.02
7.4.150.0070.01017.40
7.4.140.0110.00717.86
7.4.130.0090.01417.02
7.4.120.0130.00617.28
7.4.110.0120.00616.89
7.4.100.0100.01317.18
7.4.90.0090.00917.14
7.4.80.0130.00719.39
7.4.70.0130.00316.94
7.4.60.0140.00317.00
7.4.50.0050.00017.05
7.4.40.0110.00716.95
7.4.30.0150.00917.11
7.4.00.0060.01015.29
7.3.330.0000.00513.81
7.3.320.0050.00014.02
7.3.310.0050.00217.09
7.3.300.0070.00017.04
7.3.290.0000.00716.96
7.3.280.0110.00816.85
7.3.270.0140.00317.40
7.3.260.0060.01217.09
7.3.250.0090.01017.00
7.3.240.0040.01317.14
7.3.230.0120.00616.87
7.3.210.0000.01817.00
7.3.200.0000.01716.98
7.3.190.0030.01417.00
7.3.180.0070.01016.94
7.3.170.0160.00017.12
7.3.160.0090.01417.30
7.2.330.0070.01017.20
7.2.320.0030.01417.25
7.2.310.0000.02317.19
7.2.300.0030.01517.12
7.2.290.0090.00917.14
7.2.60.0000.01717.59
7.2.00.0060.00919.96
7.1.200.0030.01016.34
7.1.100.0060.00618.61
7.1.70.0070.01017.82
7.1.60.0090.01619.12
7.1.50.0030.01917.70
7.1.00.0030.07322.65
7.0.200.0180.00315.30
7.0.60.0100.06320.23
7.0.50.0030.08318.16
7.0.40.0070.07020.38
7.0.30.0230.05020.33
7.0.20.0200.08320.20
7.0.10.0070.08720.38
7.0.00.0200.07720.21
5.6.280.0070.06721.16
5.6.210.0000.06020.88
5.6.200.0070.06718.40
5.6.190.0030.06320.68
5.6.180.0500.06720.75
5.6.170.0270.05320.72
5.6.160.0000.04320.69
5.6.150.0030.05718.32
5.6.140.0100.08018.32
5.6.130.0070.09018.39
5.6.120.0030.05721.19
5.6.110.0030.08721.29
5.6.100.0100.07021.16
5.6.90.0030.06321.27
5.6.80.0130.07720.61
5.5.350.0300.07320.64
5.5.340.0070.03718.28
5.5.330.0170.07720.52
5.5.320.0170.07020.53
5.5.310.0300.07320.36
5.5.300.0070.08318.27
5.5.290.0030.05718.09
5.5.280.0070.05020.92
5.5.270.0030.08721.01
5.5.260.0130.07721.01
5.5.250.0030.05020.85
5.5.240.0030.07020.33
5.4.450.0100.06319.69
5.4.440.0400.05719.59
5.4.430.0770.07319.60
5.4.420.0900.05719.60
5.4.410.1130.07319.29
5.4.400.0570.06318.97
5.4.390.1130.05019.57
5.4.380.0700.05718.97
5.4.370.0770.06318.94
5.4.360.0130.06018.97
5.4.350.0770.07019.50
5.4.340.0570.07019.09
5.4.320.0830.05719.28
5.4.310.0630.06018.96
5.4.300.0600.05319.21
5.4.290.0570.05719.27
5.4.280.0300.05019.08
5.4.270.0770.05719.27
5.4.260.0570.06719.43
5.4.250.0400.06719.13
5.4.240.0630.05319.25
5.4.230.0670.06719.27
5.4.220.0630.06019.40
5.4.210.0770.06719.39
5.4.200.0930.07017.02
5.4.190.0800.05719.11
5.4.180.0670.06319.09
5.4.170.0730.06719.37
5.4.160.0870.04319.16
5.4.150.0670.06019.32
5.4.140.0830.06716.88
5.4.130.0800.05716.72
5.4.120.0770.07316.53
5.4.110.1000.06716.55
5.4.100.0830.05316.47
5.4.90.0730.04316.45
5.4.80.0800.04016.57
5.4.70.0900.05316.58
5.4.60.0770.05316.43
5.4.50.1100.04716.43
5.4.40.0830.04316.48
5.4.30.0600.06316.58
5.4.20.0830.06016.63
5.4.10.0900.06316.51
5.4.00.0830.04315.97
5.3.290.0970.06314.91
5.3.280.0730.06314.81
5.3.270.1300.06314.95
5.3.260.0970.05014.88
5.3.250.0830.06314.95
5.3.240.1030.07014.85
5.3.230.0800.07014.82
5.3.220.0830.05314.76
5.3.210.1070.05714.82
5.3.200.1030.05714.99
5.3.190.1130.05714.75
5.3.180.0800.07014.99
5.3.170.0870.06314.78
5.3.160.1000.06014.73
5.3.150.0700.05714.73
5.3.140.1100.04714.82
5.3.130.0670.06314.84
5.3.120.0900.05714.71
5.3.110.0900.06014.97
5.3.100.0970.05714.21
5.3.90.0730.06014.23
5.3.80.0800.05714.27
5.3.70.0970.05314.14
5.3.60.1070.05014.24
5.3.50.0800.05314.16
5.3.40.0870.05014.12
5.3.30.0930.04714.18
5.3.20.1070.05313.63
5.3.10.0870.05013.88
5.3.00.0930.03713.72
5.2.170.0800.04711.30
5.2.160.0730.04011.29
5.2.150.0630.04311.45
5.2.140.0830.04011.11
5.2.130.0530.04711.25
5.2.120.0700.04311.11
5.2.110.0670.04711.10
5.2.100.0870.06011.08
5.2.90.0870.05711.08
5.2.80.0670.05311.07
5.2.70.1030.05011.12
5.2.60.0730.05011.08
5.2.50.0270.05311.00
5.2.40.0530.04011.13
5.2.30.0600.04310.98
5.2.20.0570.03710.94
5.2.10.0530.04310.80
5.2.00.0730.05010.78
5.1.60.0530.0409.94
5.1.50.0600.03310.07
5.1.40.0730.0309.87
5.1.30.0530.04010.39
5.1.20.0670.04010.38
5.1.10.0700.03710.13
5.1.00.0700.02710.02
5.0.50.0200.0308.59
5.0.40.0230.0378.45
5.0.30.0330.0438.29
5.0.20.0200.0338.11
5.0.10.0270.0308.24
5.0.00.0230.0508.33
4.4.90.0200.0235.80
4.4.80.0270.0235.84
4.4.70.0300.0235.83
4.4.60.0230.0235.78
4.4.50.0330.0235.77
4.4.40.0270.0375.84
4.4.30.0330.0175.79
4.4.20.0330.0235.83
4.4.10.0200.0205.88
4.4.00.0300.0405.82
4.3.110.0270.0305.76
4.3.100.0330.0135.77
4.3.90.0270.0205.83
4.3.80.0170.0305.73
4.3.70.0400.0205.73
4.3.60.0230.0275.66
4.3.50.0270.0235.73
4.3.40.0300.0405.61
4.3.30.0130.0274.51
4.3.20.0130.0234.49
4.3.10.0130.0234.45
4.3.00.0130.0208.46

preferences:
46.06 ms | 400 KiB | 5 Q