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->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.0160.00617.25
8.3.50.0110.00821.35
8.3.40.0030.01319.43
8.3.30.0150.00619.42
8.3.20.0040.00420.43
8.3.10.0030.00623.91
8.3.00.0050.00323.98
8.2.180.0120.00617.10
8.2.170.0040.01122.96
8.2.160.0140.00322.31
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0050.00326.16
8.2.120.0060.00318.00
8.2.110.0060.00619.39
8.2.100.0130.00018.25
8.2.90.0080.00019.64
8.2.80.0000.00818.00
8.2.70.0050.00318.13
8.2.60.0030.00618.30
8.2.50.0080.00018.13
8.2.40.0080.00021.51
8.2.30.0000.00818.53
8.2.20.0000.00818.24
8.2.10.0040.00418.59
8.2.00.0040.00418.54
8.1.280.0110.00425.92
8.1.270.0040.00420.57
8.1.260.0050.00326.35
8.1.250.0050.00328.09
8.1.240.0100.00021.55
8.1.230.0040.00818.03
8.1.220.0050.00318.00
8.1.210.0050.00318.77
8.1.200.0030.00617.85
8.1.190.0050.00317.75
8.1.180.0000.00818.10
8.1.170.0030.00619.15
8.1.160.0000.00722.25
8.1.150.0040.00419.36
8.1.140.0040.00418.07
8.1.130.0040.00418.16
8.1.120.0000.00717.86
8.1.110.0080.00018.06
8.1.100.0080.00017.98
8.1.90.0000.00718.07
8.1.80.0040.00417.94
8.1.70.0000.00818.09
8.1.60.0000.01018.10
8.1.50.0030.00617.91
8.1.40.0030.00617.97
8.1.30.0030.00517.96
8.1.20.0040.00418.01
8.1.10.0050.00318.11
8.1.00.0000.00818.09
8.0.300.0000.00918.77
8.0.290.0070.00017.38
8.0.280.0030.00318.84
8.0.270.0050.00317.51
8.0.260.0000.00717.68
8.0.250.0040.00417.57
8.0.240.0000.00717.59
8.0.230.0030.00517.48
8.0.220.0070.00017.58
8.0.210.0060.00317.56
8.0.200.0030.00317.45
8.0.190.0050.00317.53
8.0.180.0040.00417.62
8.0.170.0080.00017.57
8.0.160.0070.00017.58
8.0.150.0080.00017.45
8.0.140.0030.00317.42
8.0.130.0000.00913.80
8.0.120.0030.00617.41
8.0.110.0000.00817.56
8.0.100.0060.00317.46
8.0.90.0040.00417.55
8.0.80.0100.01317.50
8.0.70.0000.00717.43
8.0.60.0040.00417.54
8.0.50.0000.00817.48
8.0.30.0120.00617.55
8.0.20.0060.01317.47
8.0.10.0040.00417.50
8.0.00.0100.00917.33
7.4.330.0030.00315.46
7.4.320.0040.00417.23
7.4.300.0030.00317.21
7.4.290.0030.00317.31
7.4.280.0000.00717.10
7.4.270.0000.00717.03
7.4.260.0080.00317.18
7.4.250.0000.00817.18
7.4.240.0040.00317.10
7.4.230.0070.00017.29
7.4.220.0110.00717.03
7.4.210.0050.01217.03
7.4.200.0080.00017.00
7.4.160.0070.01016.98
7.4.150.0150.00617.40
7.4.140.0140.00917.86
7.4.130.0100.00717.00
7.4.120.0110.00917.08
7.4.110.0090.00916.84
7.4.100.0060.01316.91
7.4.90.0130.00717.14
7.4.80.0100.01119.39
7.4.70.0120.00617.16
7.4.60.0100.00617.11
7.4.50.0000.00716.93
7.4.40.0030.01417.21
7.4.30.0130.01016.90
7.4.00.0060.00915.47
7.3.330.0020.00213.93
7.3.320.0050.00013.87
7.3.310.0070.00016.81
7.3.300.0040.00416.96
7.3.290.0070.00016.98
7.3.280.0140.00416.79
7.3.270.0070.01017.40
7.3.260.0120.01216.95
7.3.250.0090.01116.93
7.3.240.0090.00917.02
7.3.230.0070.01117.15
7.3.210.0100.01016.88
7.3.200.0100.00716.95
7.3.190.0060.00916.93
7.3.180.0060.01017.01
7.3.170.0090.00916.99
7.3.160.0160.00816.99
7.2.330.0040.01417.04
7.2.320.0060.01017.11
7.2.310.0140.00317.17
7.2.300.0030.02017.04
7.2.290.0060.01217.31
7.2.00.0100.01019.91
7.1.100.0030.00918.82
7.1.70.0000.01117.78
7.1.60.0060.01919.12
7.1.50.0060.01917.46
7.1.00.0030.07722.52
7.0.200.0210.00615.24
7.0.60.0030.08320.07
7.0.50.0070.07318.11
7.0.40.0100.04320.54
7.0.30.0300.05020.23
7.0.20.0200.08720.38
7.0.10.0100.06020.54
7.0.00.0030.06320.37
5.6.280.0030.07320.98
5.6.210.0100.08020.89
5.6.200.0130.04018.31
5.6.190.0130.03720.73
5.6.180.0470.07020.73
5.6.170.0400.06720.62
5.6.160.0070.06020.56
5.6.150.0070.08018.30
5.6.140.0000.06318.32
5.6.130.0170.07718.30
5.6.120.0070.07721.28
5.6.110.0130.08021.22
5.6.100.0170.07321.11
5.6.90.0130.04721.26
5.6.80.0100.07720.66
5.5.350.0170.04320.69
5.5.340.0130.07718.27
5.5.330.0130.03320.53
5.5.320.0200.05720.53
5.5.310.0200.04720.40
5.5.300.0130.07718.08
5.5.290.0100.04018.10
5.5.280.0000.07321.01
5.5.270.0030.05021.18
5.5.260.0070.06721.02
5.5.250.0000.06320.89
5.5.240.0100.06320.30
5.4.450.0300.05019.58
5.4.440.0770.06319.30
5.4.430.0670.06319.29
5.4.420.0630.06719.59
5.4.410.0670.06719.76
5.4.400.1070.05719.00
5.4.390.1270.06019.28
5.4.380.0930.05319.28
5.4.370.0900.05718.98
5.4.360.1030.05019.43
5.4.350.0930.05318.98
5.4.340.0830.07019.14
5.4.320.0930.05719.55
5.4.310.0730.06319.38
5.4.300.0800.07019.27
5.4.290.0930.06318.98
5.4.280.0900.05319.26
5.4.270.0830.05718.99
5.4.260.1070.05319.57
5.4.250.0970.06019.08
5.4.240.1270.05319.40
5.4.230.1030.06719.40
5.4.220.1000.05019.25
5.4.210.1100.04319.16
5.4.200.1230.03716.95
5.4.190.0830.06019.57
5.4.180.1170.05018.96
5.4.170.1030.05719.11
5.4.160.1100.03719.22
5.4.150.0900.06319.39
5.4.140.1030.05316.66
5.4.130.0970.05016.92
5.4.120.0800.06316.68
5.4.110.1200.06316.67
5.4.100.1070.07016.59
5.4.90.1330.06716.67
5.4.80.1130.06716.63
5.4.70.1230.06316.54
5.4.60.1270.06316.43
5.4.50.1200.06316.56
5.4.40.1230.07016.57
5.4.30.1300.05316.44
5.4.20.1200.06316.43
5.4.10.1130.06316.57
5.4.00.1170.05316.02
5.3.290.0970.06314.86
5.3.280.0930.06314.84
5.3.270.0930.07015.03
5.3.260.1070.09014.82
5.3.250.0900.07314.78
5.3.240.1070.07014.79
5.3.230.0770.07314.78
5.3.220.0830.05714.82
5.3.210.0770.06714.91
5.3.200.0400.05714.80
5.3.190.0570.04714.77
5.3.180.0700.07314.83
5.3.170.0630.07014.85
5.3.160.1000.05714.82
5.3.150.0700.05314.83
5.3.140.0830.05014.73
5.3.130.0200.05314.80
5.3.120.1070.08014.76
5.3.110.0870.06014.89
5.3.100.0570.04314.21
5.3.90.0130.06714.29
5.3.80.0770.05714.28
5.3.70.0700.06014.23
5.3.60.0670.06014.16
5.3.50.0730.04714.21
5.3.40.0630.06014.20
5.3.30.0670.07014.18
5.3.20.0700.06013.78
5.3.10.0730.05013.78
5.3.00.0730.06013.77
5.2.170.0570.04711.45
5.2.160.0700.04711.23
5.2.150.0300.04711.22
5.2.140.0330.04711.13
5.2.130.0730.03311.26
5.2.120.0630.04011.18
5.2.110.0700.03011.08
5.2.100.0500.04711.13
5.2.90.0600.04311.25
5.2.80.0670.03711.24
5.2.70.0630.03311.12
5.2.60.0700.04311.05
5.2.50.0530.04711.02
5.2.40.0570.03711.16
5.2.30.0530.03710.97
5.2.20.0500.04710.95
5.2.10.0670.03311.09
5.2.00.0530.03710.87
5.1.60.0330.0339.94
5.1.50.0400.0409.91
5.1.40.0530.03010.04
5.1.30.0270.03710.25
5.1.20.0200.04710.27
5.1.10.0470.0379.92
5.1.00.0570.0409.92
5.0.50.0200.0208.64
5.0.40.0000.0308.31
5.0.30.0230.0438.22
5.0.20.0330.0178.10
5.0.10.0330.0278.08
5.0.00.0100.0438.11
4.4.90.0200.0205.80
4.4.80.0370.0205.79
4.4.70.0230.0175.76
4.4.60.0230.0275.74
4.4.50.0200.0235.75
4.4.40.0230.0375.83
4.4.30.0030.0235.84
4.4.20.0030.0235.82
4.4.10.0200.0205.89
4.4.00.0100.0435.80
4.3.110.0200.0305.78
4.3.100.0330.0205.79
4.3.90.0200.0205.73
4.3.80.0370.0305.66
4.3.70.0000.0235.76
4.3.60.0300.0205.79
4.3.50.0400.0235.73
4.3.40.0200.0305.72
4.3.30.0100.0234.43
4.3.20.0100.0234.49
4.3.10.0130.0204.36
4.3.00.0070.0208.45

preferences:
72.2 ms | 401 KiB | 5 Q