3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @param string $from * @param string $to * @return string */ function dateDiffString($from, $to) { $fromDate = new \DateTime($from); $toDate = new \DateTime($to); if($fromDate->format('Y') !== $toDate->format('Y')){ return $fromDate->format('M d Y') . " - " . $toDate->format('M d Y'); } if($fromDate->format('m') !== $toDate->format('m')){ return $fromDate->format('M d') . ' - ' . $toDate->format('M d, Y'); } return $fromDate->format('M d') . ' - ' . $toDate->format('d, Y'); } $from = '2015-03-29'; $to = '2015-04-03'; echo dateDiffString($from, $to) . PHP_EOL; $from = '2015-03-31'; $to = '2015-04-02'; echo dateDiffString($from, $to) . PHP_EOL; $from = '2015-03-05'; $to = '2015-03-07'; echo dateDiffString($from, $to) . PHP_EOL;

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.0140.00718.55
8.3.50.0130.00821.99
8.3.40.0120.00318.88
8.3.30.0070.00719.08
8.3.20.0050.00320.18
8.3.10.0000.00823.37
8.3.00.0030.00618.94
8.2.180.0190.00317.00
8.2.170.0080.00822.96
8.2.160.0100.00322.26
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0000.00726.16
8.2.120.0040.00421.05
8.2.110.0070.00322.25
8.2.100.0040.01118.03
8.2.90.0000.00917.75
8.2.80.0050.00318.91
8.2.70.0000.00818.16
8.2.60.0060.00617.96
8.2.50.0060.00318.10
8.2.40.0040.00419.48
8.2.30.0040.00419.22
8.2.20.0080.00017.83
8.2.10.0040.00418.08
8.2.00.0040.00417.99
8.1.280.0120.00625.92
8.1.270.0040.00418.71
8.1.260.0020.00526.35
8.1.250.0030.00528.09
8.1.240.0060.00322.04
8.1.230.0110.00017.89
8.1.220.0040.00417.79
8.1.210.0040.00418.77
8.1.200.0040.00417.47
8.1.190.0000.00817.48
8.1.180.0090.00018.10
8.1.170.0060.00318.68
8.1.160.0080.00019.02
8.1.150.0080.00018.85
8.1.140.0040.00419.34
8.1.130.0080.00017.92
8.1.120.0000.00717.75
8.1.110.0000.00817.66
8.1.100.0000.00717.58
8.1.90.0030.00317.57
8.1.80.0000.00717.68
8.1.70.0030.00317.64
8.1.60.0040.00417.71
8.1.50.0000.00817.57
8.1.40.0130.00017.54
8.1.30.0000.00817.81
8.1.20.0000.00817.81
8.1.10.0040.00417.59
8.1.00.0070.00017.63
8.0.300.0040.00418.77
8.0.290.0060.00317.00
8.0.280.0000.00818.55
8.0.270.0030.00317.28
8.0.260.0030.00318.46
8.0.250.0000.00717.22
8.0.240.0040.00417.13
8.0.230.0050.00217.18
8.0.220.0000.00716.98
8.0.210.0030.00317.09
8.0.200.0080.00017.04
8.0.190.0000.00717.06
8.0.180.0040.00417.14
8.0.170.0050.00317.18
8.0.160.0030.00317.02
8.0.150.0050.00217.07
8.0.140.0040.00416.99
8.0.130.0000.00713.43
8.0.120.0000.00816.97
8.0.110.0080.00017.11
8.0.100.0050.00217.03
8.0.90.0000.00717.18
8.0.80.0070.01617.12
8.0.70.0070.00016.98
8.0.60.0000.00716.98
8.0.50.0080.00017.16
8.0.30.0130.01117.11
8.0.20.0110.00817.40
8.0.10.0040.00417.20
8.0.00.0090.01016.96
7.4.330.0030.00315.03
7.4.320.0000.00716.75
7.4.300.0000.00716.55
7.4.290.0120.00016.77
7.4.280.0000.00816.65
7.4.270.0000.00716.66
7.4.260.0060.00316.76
7.4.250.0040.00416.73
7.4.240.0020.00616.72
7.4.230.0030.00316.46
7.4.220.0130.00716.62
7.4.210.0110.00416.84
7.4.200.0040.00416.71
7.4.160.0090.00616.84
7.4.150.0070.01117.40
7.4.140.0120.00817.86
7.4.130.0090.00816.79
7.4.120.0120.00816.77
7.4.110.0140.00716.71
7.4.100.0060.01116.68
7.4.90.0040.01416.61
7.4.80.0100.00719.39
7.4.70.0100.00716.74
7.4.60.0080.00816.66
7.4.50.0000.00516.25
7.4.40.0140.00316.72
7.4.30.0120.00916.74
7.4.00.0060.00915.10
7.3.330.0050.00013.40
7.3.320.0030.00313.34
7.3.310.0030.00316.40
7.3.300.0030.00316.38
7.3.290.0060.01116.43
7.3.280.0080.01016.36
7.3.270.0090.00917.40
7.3.260.0090.00916.58
7.3.250.0110.00916.51
7.3.240.0040.01616.56
7.3.230.0120.00916.39
7.3.210.0100.01016.60
7.3.200.0100.01019.39
7.3.190.0120.00316.62
7.3.180.0100.00716.63
7.3.170.0110.00816.46
7.3.160.0100.00716.40
7.3.120.0090.00815.07
7.3.110.0080.01015.14
7.3.100.0080.01014.89
7.3.90.0070.01015.00
7.3.80.0030.00914.87
7.3.70.0030.00814.78
7.3.60.0050.00914.84
7.3.50.0050.00714.83
7.3.40.0040.01114.75
7.3.30.0060.00614.81
7.3.20.0080.00316.52
7.3.10.0050.01016.49
7.3.00.0050.00816.82
7.2.330.0070.01116.86
7.2.320.0080.00816.98
7.2.310.0160.00016.84
7.2.300.0110.00616.94
7.2.290.0130.00516.92
7.2.250.0090.00915.36
7.2.240.0080.00915.30
7.2.230.0090.00615.35
7.2.220.0030.01115.01
7.2.210.0090.00615.28
7.2.200.0070.00915.23
7.2.190.0090.00515.27
7.2.180.0030.01015.14
7.2.170.0040.00815.20
7.2.60.0100.00316.97
7.2.00.0090.00619.73
7.1.330.0050.01015.92
7.1.320.0060.00515.68
7.1.310.0080.00515.67
7.1.300.0040.00715.87
7.1.290.0020.01215.86
7.1.280.0020.01115.92
7.1.270.0030.00915.95
7.1.260.0020.01015.99
7.1.100.0070.00418.36
7.1.70.0000.00817.08
7.1.60.0120.01219.46
7.1.50.0070.01417.15
7.1.00.0000.08022.54
7.0.200.0250.00416.71
7.0.140.0000.05021.98
7.0.100.0430.05720.04
7.0.90.0170.08319.92
7.0.80.0100.04320.07
7.0.70.0070.08320.07
7.0.60.0070.08020.12
7.0.50.0130.04720.34
7.0.40.0130.07720.12
7.0.30.0070.04720.13
7.0.20.0130.09720.05
7.0.10.0130.07320.06
7.0.00.0030.04320.01
5.6.280.0100.06720.86
5.6.250.0130.07720.63
5.6.240.0100.08720.69
5.6.230.0030.05020.62
5.6.220.0070.07020.59
5.6.210.0170.07020.66
5.6.200.0070.05021.10
5.6.190.0070.07720.93
5.6.180.0100.06021.17
5.6.170.0170.07321.07
5.6.160.0100.07720.93
5.6.150.0130.07721.10
5.6.140.0200.05720.98
5.6.130.0200.07721.03
5.6.120.0130.07721.01
5.6.110.0100.08321.10
5.6.100.0030.06021.07
5.6.90.0070.05721.02
5.6.80.0070.06320.49
5.6.70.0170.07020.46
5.6.60.0170.07320.37
5.6.50.0070.07720.40
5.6.40.0070.04320.43
5.6.30.0070.05020.53
5.6.20.0070.06020.37
5.6.10.0070.05020.28
5.6.00.0130.04720.50
5.5.380.0100.07720.43
5.5.370.0100.08020.52
5.5.360.0000.08720.56
5.5.350.0100.08020.46
5.5.340.0170.06720.90
5.5.330.0070.07320.76
5.5.320.0100.04320.93
5.5.310.0000.06320.89
5.5.300.0130.07020.88
5.5.290.0130.07320.88
5.5.280.0000.09020.77
5.5.270.0030.05320.78
5.5.260.0270.06320.89
5.5.250.0070.05720.66
5.5.240.0030.08320.28
5.5.230.0130.07720.26
5.5.220.0070.08319.98
5.5.210.0130.06020.14
5.5.200.0030.08320.27
5.5.190.0200.07320.14
5.5.180.0030.07720.25
5.5.160.0070.03719.96
5.5.150.0130.06720.23
5.5.140.0130.07020.18
5.5.130.0000.06020.17
5.5.120.0130.06020.26
5.5.110.0030.07020.25
5.5.100.0070.08020.10
5.5.90.0130.06020.00
5.5.80.0070.06020.06
5.5.70.0100.08020.09
5.5.60.0100.07719.95
5.5.50.0100.08020.05
5.5.40.0030.08320.11
5.5.30.0130.07019.98
5.5.20.0070.08019.95
5.5.10.0070.08020.10
5.5.00.0130.05720.01
5.4.450.0070.08319.46
5.4.440.0030.05319.23
5.4.430.0000.08019.35
5.4.420.0070.04319.46
5.4.410.0030.08019.39
5.4.400.0100.07319.05
5.4.390.0030.05319.18
5.4.380.0030.08319.23
5.4.370.0170.03719.25
5.4.360.0070.05319.23
5.4.350.0070.08019.03
5.4.340.0100.07318.85
5.4.320.0130.07718.88
5.4.310.0070.06019.03
5.4.300.0070.04019.12
5.4.290.0030.07018.92
5.4.280.0070.04019.13
5.4.270.0070.04019.09
5.4.260.0100.07319.22
5.4.250.0100.06319.02
5.4.240.0000.07319.22
5.4.230.0100.06718.89
5.4.220.0070.07018.87
5.4.210.0170.05019.04
5.4.200.0000.08318.84
5.4.190.0030.07719.02
5.4.180.0030.05018.99
5.4.170.0130.07318.93
5.4.160.0100.03319.03
5.4.150.0070.07719.18
5.4.140.0070.05316.34
5.4.130.0070.05016.21
5.4.120.0070.05016.32
5.4.110.0030.07716.36
5.4.100.0030.07716.50
5.4.90.0130.08016.27
5.4.80.0070.06316.32
5.4.70.0130.05316.34
5.4.60.0070.06316.48
5.4.50.0200.05316.24
5.4.40.0030.06316.36
5.4.30.0030.08316.31
5.4.20.0030.07316.53
5.4.10.0000.05316.30
5.4.00.0030.07315.79
5.3.290.0130.06314.78
5.3.280.0200.06314.63
5.3.270.0070.07714.67
5.3.260.0070.07014.71
5.3.250.0070.05314.66
5.3.240.0030.07714.59
5.3.230.0130.07314.63
5.3.220.0100.07714.52
5.3.210.0100.07014.67
5.3.200.0030.07314.66
5.3.190.0070.07314.53
5.3.180.0070.08014.59
5.3.170.0000.08314.70
5.3.160.0100.04314.66
5.3.150.0030.06314.51
5.3.140.0000.05714.53
5.3.130.0070.05014.47
5.3.120.0070.04314.65
5.3.110.0000.05014.69
5.3.100.0070.06713.97
5.3.90.0030.07314.08
5.3.80.0100.06014.11
5.3.70.0100.08014.07
5.3.60.0170.05013.89
5.3.50.0000.05713.93
5.3.40.0100.06713.85
5.3.30.0070.07013.84
5.3.20.0100.06313.71
5.3.10.0100.07013.67
5.3.00.0130.07313.70
5.2.170.0130.05711.06
5.2.160.0100.05011.18
5.2.150.0030.06711.03
5.2.140.0070.06011.13
5.2.130.0030.06311.20
5.2.120.0030.05711.24
5.2.110.0130.05011.13
5.2.100.0070.05311.01
5.2.90.0070.05711.04
5.2.80.0130.05311.03
5.2.70.0130.03010.96
5.2.60.0100.05311.08
5.2.50.0030.05311.16
5.2.40.0100.05711.03
5.2.30.0030.06010.90
5.2.20.0070.06010.98
5.2.10.0070.04010.98
5.2.00.0070.05710.85
5.1.60.0000.04310.11
5.1.50.0130.04310.09
5.1.40.0100.05310.04
5.1.30.0100.03310.40
5.1.20.0030.04010.27
5.1.10.0030.0309.91
5.1.00.0030.05710.07
5.0.50.0070.0439.07
5.0.40.0000.0479.07
5.0.30.0030.0639.07
5.0.20.0000.0479.07
5.0.10.0030.0439.07
5.0.00.0030.0639.07
4.4.90.0030.0379.07
4.4.80.0030.0339.07
4.4.70.0030.0379.07
4.4.60.0070.0439.07
4.4.50.0000.0339.07
4.4.40.0030.0539.07
4.4.30.0000.0279.07
4.4.20.0030.0339.07
4.4.10.0100.0239.07
4.4.00.0000.0339.07
4.3.110.0030.0309.07
4.3.100.0000.0379.07
4.3.90.0000.0209.07
4.3.80.0030.0539.07
4.3.70.0030.0339.07
4.3.60.0000.0279.07
4.3.50.0000.0339.07
4.3.40.0000.0579.07
4.3.30.0000.0279.07
4.3.20.0000.0309.07
4.3.10.0000.0209.07
4.3.00.0000.0309.07

preferences:
51.07 ms | 401 KiB | 5 Q