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(); echo $dt->format('z'); 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.0110.00418.93
8.3.50.0110.00821.33
8.3.40.0100.00719.50
8.3.30.0070.01419.21
8.3.20.0080.00020.54
8.3.10.0090.00023.83
8.3.00.0050.00323.78
8.2.180.0100.00617.25
8.2.170.0040.01122.96
8.2.160.0100.00322.59
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0030.00526.16
8.2.120.0060.00318.13
8.2.110.0000.01019.44
8.2.100.0120.00018.13
8.2.90.0040.00419.67
8.2.80.0000.00818.25
8.2.70.0100.00018.11
8.2.60.0000.00918.17
8.2.50.0060.00318.07
8.2.40.0000.00821.55
8.2.30.0090.00018.46
8.2.20.0080.00018.25
8.2.10.0040.00418.53
8.2.00.0040.00418.57
8.1.280.0210.00025.92
8.1.270.0080.00020.57
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0030.00722.51
8.1.230.0080.00418.27
8.1.220.0050.00318.14
8.1.210.0030.00618.77
8.1.200.0040.00717.97
8.1.190.0040.00417.75
8.1.180.0080.00018.10
8.1.170.0030.00619.10
8.1.160.0040.00422.38
8.1.150.0040.00419.32
8.1.140.0060.00318.08
8.1.130.0030.00318.15
8.1.120.0000.00818.07
8.1.110.0070.00017.96
8.1.100.0070.00018.02
8.1.90.0040.00418.00
8.1.80.0050.00218.02
8.1.70.0040.00418.04
8.1.60.0060.00318.17
8.1.50.0050.00318.02
8.1.40.0060.00318.04
8.1.30.0030.00617.91
8.1.20.0000.00818.04
8.1.10.0040.00418.13
8.1.00.0080.00017.98
8.0.300.0050.00318.77
8.0.290.0070.00017.50
8.0.280.0040.00418.74
8.0.270.0030.00317.67
8.0.260.0050.00317.64
8.0.250.0000.00817.55
8.0.240.0080.00017.57
8.0.230.0060.00317.50
8.0.220.0030.00317.50
8.0.210.0030.00517.48
8.0.200.0030.00317.41
8.0.190.0000.00917.55
8.0.180.0070.00017.35
8.0.170.0040.00417.51
8.0.160.0000.00717.58
8.0.150.0040.00417.47
8.0.140.0030.00517.50
8.0.130.0080.00013.87
8.0.120.0040.00417.57
8.0.110.0040.00417.47
8.0.100.0040.00417.50
8.0.90.0070.00017.42
8.0.80.0120.00617.52
8.0.70.0030.00517.39
8.0.60.0070.00017.52
8.0.50.0070.00017.54
8.0.30.0100.01017.54
8.0.20.0140.00517.61
8.0.10.0070.00017.76
8.0.00.0080.01217.34
7.4.330.0050.00015.50
7.4.320.0040.00417.04
7.4.300.0000.00617.07
7.4.290.0070.00017.14
7.4.280.0040.00417.19
7.4.270.0000.00717.14
7.4.260.0040.00317.08
7.4.250.0040.00417.14
7.4.240.0050.00217.12
7.4.230.0000.00817.27
7.4.220.0060.01517.03
7.4.210.0080.00617.02
7.4.200.0080.00017.23
7.4.160.0040.01217.10
7.4.150.0120.00817.40
7.4.140.0120.01017.86
7.4.130.0150.00717.09
7.4.120.0130.00417.18
7.4.110.0030.01917.10
7.4.100.0160.00717.09
7.4.90.0100.00717.13
7.4.80.0150.00319.39
7.4.70.0060.01117.00
7.4.60.0040.01316.99
7.4.50.0000.00516.91
7.4.40.0100.00716.93
7.4.30.0140.00617.02
7.4.00.0040.01215.63
7.3.330.0030.00313.72
7.3.320.0030.00313.95
7.3.310.0070.00016.77
7.3.300.0070.00016.95
7.3.290.0000.00716.89
7.3.280.0110.00816.77
7.3.270.0120.00917.40
7.3.260.0060.01516.92
7.3.250.0190.01116.92
7.3.240.0130.00316.94
7.3.230.0110.00717.00
7.3.210.0090.00916.80
7.3.200.0110.00716.90
7.3.190.0100.01017.01
7.3.180.0100.00617.17
7.3.170.0100.00717.03
7.3.160.0180.00516.93
7.2.330.0110.00617.26
7.2.320.0130.00317.07
7.2.310.0030.01317.27
7.2.300.0080.01117.21
7.2.290.0090.00916.90
7.2.00.0110.01119.88
7.1.100.0060.00618.68
7.1.70.0030.00717.61
7.1.60.0030.02019.12
7.1.50.0140.01117.34
7.1.00.0070.07322.50
7.0.200.0060.00615.45
7.0.60.0000.04720.18
7.0.50.0030.08318.24
7.0.40.0170.07320.32
7.0.30.0230.04720.21
7.0.20.0270.07320.24
7.0.10.0070.07720.20
7.0.00.0070.06320.30
5.6.280.0030.06721.29
5.6.210.0070.08320.77
5.6.200.0070.07718.44
5.6.190.0000.09720.75
5.6.180.0400.04320.73
5.6.170.0330.05720.59
5.6.160.0100.08020.73
5.6.150.0030.08018.30
5.6.140.0000.04718.46
5.6.130.0070.07018.32
5.6.120.0100.08021.29
5.6.110.0070.07321.14
5.6.100.0100.07021.34
5.6.90.0200.05321.20
5.6.80.0100.08320.57
5.5.350.0370.06320.59
5.5.340.0070.04718.17
5.5.330.0100.04720.31
5.5.320.0300.04720.38
5.5.310.0230.09020.37
5.5.300.0030.08718.10
5.5.290.0100.05718.10
5.5.280.0170.07021.03
5.5.270.0070.07021.00
5.5.260.0100.06720.88
5.5.250.0030.08320.78
5.5.240.0030.08020.36
5.4.450.0230.06019.79
5.4.440.0870.06719.29
5.4.430.1130.05319.54
5.4.420.0700.05719.88
5.4.410.0730.07319.45
5.4.400.0800.08019.27
5.4.390.0700.08019.14
5.4.380.0830.06319.09
5.4.370.0730.06319.25
5.4.360.0870.06019.54
5.4.350.0770.05319.25
5.4.340.0730.05019.38
5.4.320.0600.06019.48
5.4.310.0930.04719.40
5.4.300.0700.06019.37
5.4.290.0900.05319.25
5.4.280.0700.06319.24
5.4.270.0830.05318.97
5.4.260.0770.05019.40
5.4.250.0870.06719.43
5.4.240.0970.05319.43
5.4.230.0870.04719.41
5.4.220.0930.07319.24
5.4.210.1270.05319.14
5.4.200.0930.04716.82
5.4.190.1000.05719.02
5.4.180.0900.05719.42
5.4.170.1000.04719.08
5.4.160.0530.06719.36
5.4.150.1170.04019.07
5.4.140.0700.06016.73
5.4.130.1000.04016.73
5.4.120.1170.07016.68
5.4.110.0900.04316.67
5.4.100.0800.06016.66
5.4.90.0900.05316.45
5.4.80.0830.05016.70
5.4.70.0800.06016.63
5.4.60.1070.04716.80
5.4.50.0870.05016.70
5.4.40.0830.05016.58
5.4.30.0800.05016.55
5.4.20.0970.06716.46
5.4.10.0770.06016.84
5.4.00.0730.05715.95
5.3.290.0830.06014.91
5.3.280.0870.06714.86
5.3.270.0930.06014.79
5.3.260.0800.05314.74
5.3.250.0800.04714.85
5.3.240.0870.04714.78
5.3.230.0730.06314.86
5.3.220.0900.06014.82
5.3.210.0900.05714.77
5.3.200.1000.05014.78
5.3.190.0770.05014.75
5.3.180.0870.04714.81
5.3.170.0730.05014.72
5.3.160.0730.05014.74
5.3.150.0870.06314.79
5.3.140.0870.07314.81
5.3.130.0830.05014.81
5.3.120.0970.06014.97
5.3.110.1100.06714.76
5.3.100.0800.05714.19
5.3.90.0630.05714.27
5.3.80.0070.05714.20
5.3.70.0030.06014.30
5.3.60.0430.04714.22
5.3.50.1170.05014.17
5.3.40.0800.05014.15
5.3.30.0630.06314.34
5.3.20.0600.05313.70
5.3.10.0030.06013.79
5.3.00.0000.06013.79
5.2.170.0370.05311.13
5.2.160.0530.07011.13
5.2.150.0600.05311.36
5.2.140.0130.05011.27
5.2.130.0070.05011.32
5.2.120.0070.04011.32
5.2.110.0700.05711.03
5.2.100.0730.05711.18
5.2.90.0730.05711.23
5.2.80.0900.05011.10
5.2.70.0730.05311.08
5.2.60.0930.05011.03
5.2.50.0930.04011.00
5.2.40.0530.04011.00
5.2.30.0430.04710.98
5.2.20.0570.04010.90
5.2.10.0830.04010.92
5.2.00.0630.04310.68
5.1.60.0530.04710.01
5.1.50.0530.03710.23
5.1.40.0470.0439.96
5.1.30.0700.03710.26
5.1.20.0470.03010.51
5.1.10.0400.04710.00
5.1.00.0630.03310.26
5.0.50.0300.0338.49
5.0.40.0330.0338.41
5.0.30.0230.0508.22
5.0.20.0330.0378.23
5.0.10.0270.0478.34
5.0.00.0300.0538.26
4.4.90.0230.0205.75
4.4.80.0300.0235.75
4.4.70.0400.0305.80
4.4.60.0330.0275.82
4.4.50.0200.0205.84
4.4.40.0300.0305.76
4.4.30.0270.0235.84
4.4.20.0230.0275.87
4.4.10.0230.0275.89
4.4.00.0300.0375.86
4.3.110.0270.0435.69
4.3.100.0370.0275.73
4.3.90.0300.0335.83
4.3.80.0330.0435.75
4.3.70.0370.0235.79
4.3.60.0270.0275.75
4.3.50.0330.0335.72
4.3.40.0530.0305.63
4.3.30.0030.0274.41
4.3.20.0100.0274.49
4.3.10.0200.0234.45
4.3.00.0100.0238.46

preferences:
56.97 ms | 401 KiB | 5 Q