3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('UTC'); function dateDiff($startdate, $enddate) { $first = $startdate < $enddate ? $startdate : $enddate; $second = $startdate < $enddate ? $enddate : $startdate; $inbetween = $second - $first; $firsttemp = $first; $months = 0; $days = 0; while(TRUE) { if($firsttemp + 86400 * date('t', $firsttemp) <= $second) { $months += 1; $firsttemp += 86400 * date('t', $firsttemp); } else { if($second - $firsttemp >= 86400) { $days = floor(($second - $firsttemp) / 86400); } break; } } $years = floor($months / 12); $months = $months % 12; $hours = floor($inbetween / 60 / 60 % 24); $minutes = floor($inbetween / 60 % 60); $seconds = $inbetween % 60; $dateObj = new stdClass(); $dateObj->y = $years; $dateObj->m = $months; $dateObj->d = $days; $dateObj->h = $hours; $dateObj->i = $minutes; $dateObj->s = $seconds; $dateObj->days = floor($inbetween / 86400); return $dateObj; } $str1 = "1970-01-01"; $str2 = "2009-01-01"; $tempdate1 = $str1; $n = 0; $mydate = dateDiff(strtotime($str1), strtotime($str2)); $string = "(" . $mydate->days . ") difference " . $mydate->y . " years, " . $mydate->m . " months, " . $mydate->d . " days"; echo $string; $n += 321; $tempdate1 = $str1 . " +" . $n . " sec";

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.0120.00318.56
8.3.50.0100.00917.44
8.3.40.0150.00319.00
8.3.30.0150.00018.87
8.3.20.0000.00818.86
8.3.10.0080.00018.94
8.3.00.0040.00419.50
8.2.180.0080.00816.63
8.2.170.0060.00922.96
8.2.160.0030.01319.14
8.2.150.0040.00424.18
8.2.140.0030.00624.66
8.2.130.0040.00426.16
8.2.120.0080.00019.66
8.2.110.0090.00022.14
8.2.100.0040.00819.86
8.2.90.0040.00418.00
8.2.80.0030.00518.86
8.2.70.0030.00617.75
8.2.60.0000.00818.16
8.2.50.0000.01418.07
8.2.40.0000.00918.22
8.2.30.0030.00618.09
8.2.20.0060.00317.90
8.2.10.0000.00818.05
8.2.00.0050.00318.01
8.1.280.0090.00625.92
8.1.270.0050.00323.99
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00620.75
8.1.230.0060.00617.77
8.1.220.0060.00317.74
8.1.210.0060.00618.77
8.1.200.0000.01017.47
8.1.190.0040.00417.48
8.1.180.0060.00319.26
8.1.170.0050.00518.81
8.1.160.0040.00419.02
8.1.150.0040.00418.80
8.1.140.0080.00017.49
8.1.130.0080.00019.28
8.1.120.0050.00217.71
8.1.110.0000.00717.61
8.1.100.0030.00517.51
8.1.90.0040.00417.64
8.1.80.0000.00717.63
8.1.70.0030.00517.59
8.1.60.0030.00517.68
8.1.50.0000.00917.59
8.1.40.0040.00517.64
8.1.30.0060.00317.65
8.1.20.0000.00917.75
8.1.10.0080.00017.59
8.1.00.0030.00617.53
8.0.300.0030.00518.90
8.0.290.0050.00317.00
8.0.280.0070.00018.37
8.0.270.0000.00817.25
8.0.260.0030.00317.06
8.0.250.0000.00817.12
8.0.240.0040.00417.19
8.0.230.0030.00617.25
8.0.220.0040.00417.11
8.0.210.0030.00517.07
8.0.200.0000.00717.11
8.0.190.0090.00017.16
8.0.180.0000.00817.13
8.0.170.0050.00317.19
8.0.160.0000.00817.09
8.0.150.0060.00317.13
8.0.140.0000.00817.10
8.0.130.0000.00613.59
8.0.120.0000.01017.05
8.0.110.0000.00717.00
8.0.100.0040.00417.12
8.0.90.0040.00416.98
8.0.80.0100.00617.10
8.0.70.0000.00817.15
8.0.60.0050.00316.99
8.0.50.0060.00317.08
8.0.30.0080.00817.41
8.0.20.0080.01117.15
8.0.10.0040.00417.25
8.0.00.0130.01116.88
7.4.330.0030.00313.08
7.4.320.0040.00416.78
7.4.300.0000.00916.62
7.4.290.0060.00316.73
7.4.280.0000.00816.70
7.4.270.0000.00716.71
7.4.260.0040.00413.38
7.4.250.0040.00416.63
7.4.240.0040.00416.60
7.4.230.0080.00016.59
7.4.220.0070.02116.68
7.4.210.0090.00616.73
7.4.200.0040.00416.80
7.4.190.0050.00316.57
7.4.160.0120.00416.69
7.4.150.0040.01416.67
7.4.140.0080.01117.86
7.4.130.0120.00916.59
7.4.120.0070.01016.45
7.4.110.0100.01616.71
7.4.100.0130.00616.63
7.4.90.0130.00616.55
7.4.80.0110.00719.39
7.4.70.0090.00916.54
7.4.60.0070.01016.73
7.4.50.0000.00816.70
7.4.40.0060.00916.50
7.4.30.0130.00816.66
7.4.00.0100.00715.08
7.3.330.0050.00313.55
7.3.320.0040.00413.63
7.3.310.0040.00416.45
7.3.300.0070.00016.48
7.3.290.0090.00716.58
7.3.280.0160.00616.56
7.3.270.0120.00616.69
7.3.260.0090.00916.46
7.3.240.0100.00716.52
7.3.230.0070.01116.71
7.3.210.0070.01016.82
7.3.200.0070.01016.74
7.3.190.0120.00616.73
7.3.180.0120.00916.73
7.3.170.0090.00916.50
7.3.160.0100.00716.77
7.3.120.0030.01015.15
7.3.110.0030.01615.21
7.3.100.0120.00915.23
7.3.90.0070.01015.18
7.3.80.0140.00315.26
7.3.70.0110.00415.01
7.3.60.0100.00715.03
7.3.50.0040.00814.76
7.3.40.0060.01014.48
7.3.30.0030.01014.98
7.3.20.0060.00916.35
7.3.10.0060.00616.59
7.3.00.0060.01016.83
7.2.330.0090.00916.95
7.2.320.0060.01316.77
7.2.310.0060.01716.98
7.2.300.0030.01316.93
7.2.290.0150.00316.95
7.2.250.0040.01215.33
7.2.240.0070.01414.88
7.2.230.0060.00915.22
7.2.220.0030.01615.38
7.2.210.0060.00315.39
7.2.200.0100.00615.00
7.2.190.0040.01415.00
7.2.180.0060.00615.21
7.2.170.0080.00414.71
7.2.160.0120.00315.05
7.2.150.0110.00317.25
7.2.140.0000.01716.60
7.2.130.0030.01316.98
7.2.120.0050.00817.08
7.2.110.0070.00617.00
7.2.100.0070.00916.93
7.2.90.0060.01017.17
7.2.80.0060.01016.94
7.2.70.0050.00917.04
7.2.60.0070.00617.07
7.2.50.0070.00817.04
7.2.40.0080.00817.02
7.2.30.0080.00816.97
7.2.20.0070.00917.15
7.2.10.0060.00816.99
7.2.00.0050.01216.97
7.1.330.0030.01615.98
7.1.320.0000.01416.01
7.1.310.0060.00615.67
7.1.300.0080.00615.87
7.1.290.0000.01015.51
7.1.280.0090.00615.71
7.1.270.0080.00615.69
7.1.260.0060.00316.04
7.1.250.0070.00715.95
7.1.240.0000.01115.96
7.1.230.0040.01116.01
7.1.220.0000.01316.00
7.1.210.0060.00616.04
7.1.200.0020.00915.91
7.1.190.0060.00915.72
7.1.180.0030.01015.69
7.1.170.0000.01115.84
7.1.160.0030.01315.86
7.1.150.0060.00616.10
7.1.140.0030.01215.83
7.1.130.0090.00616.07
7.1.120.0030.01315.77
7.1.110.0060.00315.98
7.1.100.0060.00916.10
7.1.90.0150.00016.10
7.1.80.0000.01415.84
7.1.70.0040.00516.50
7.1.60.0100.01117.43
7.1.50.0080.01116.33
7.1.40.0080.00815.85
7.1.30.0030.01015.96
7.1.20.0060.00615.74
7.1.10.0000.01815.98
7.1.00.0040.02119.20
7.0.330.0000.01315.65
7.0.320.0070.00315.77
7.0.310.0070.00715.43
7.0.300.0000.01615.51
7.0.290.0100.00715.55
7.0.280.0000.01115.57
7.0.270.0120.00315.41
7.0.260.0030.01515.55
7.0.250.0000.01415.58
7.0.240.0070.00715.48
7.0.230.0030.00715.55
7.0.220.0030.01015.35
7.0.210.0030.01015.41
7.0.200.0050.00616.17
7.0.190.0070.01115.60
7.0.180.0000.01215.54
7.0.170.0040.01115.29
7.0.160.0030.00915.64
7.0.150.0040.00815.31
7.0.140.0020.04118.59
7.0.130.0070.01015.57
7.0.120.0040.03518.79
7.0.110.0060.01215.54
7.0.100.0000.01315.16
7.0.90.0020.02818.66
7.0.80.0050.02718.65
7.0.70.0050.02518.57
7.0.60.0050.02618.58
7.0.50.0030.02518.88
7.0.40.0030.02416.77
7.0.30.0030.02516.82
7.0.20.0080.02016.82
7.0.10.0030.02516.79
7.0.00.0020.02716.83
5.6.400.0030.01014.71
5.6.390.0040.00714.40
5.6.380.0000.01614.79
5.6.370.0080.00614.44
5.6.360.0040.01114.67
5.6.350.0040.00714.48
5.6.340.0090.00314.23
5.6.330.0030.01314.62
5.6.320.0090.00614.47
5.6.310.0080.00414.80
5.6.300.0030.00914.82
5.6.290.0000.00914.43
5.6.280.0060.04117.57
5.6.270.0090.00614.68
5.6.260.0060.01014.45
5.6.250.0030.00914.07
5.6.240.0050.02517.62
5.6.230.0020.02817.56
5.6.220.0080.02317.51
5.6.210.0030.02417.49
5.6.200.0030.02717.97
5.6.190.0080.02017.83
5.6.180.0040.02317.86
5.6.170.0000.02917.71
5.6.160.0030.04417.77
5.6.150.0070.04817.86
5.6.140.0050.02917.83
5.6.130.0070.04717.76
5.6.120.0080.04517.81
5.6.110.0050.04217.75
5.6.100.0080.04817.68
5.6.90.0010.05117.64
5.6.80.0080.02517.37
5.6.70.0060.03217.28
5.6.60.0080.04217.43
5.6.50.0000.03217.54
5.6.40.0020.04617.37
5.6.30.0090.03817.53
5.6.20.0070.02517.48
5.6.10.0000.02917.38
5.6.00.0080.02317.41
5.5.380.0050.02517.62
5.5.370.0070.02017.34
5.5.360.0080.02217.51
5.5.350.0070.02417.38
5.5.340.0040.03917.71
5.5.330.0020.02617.42
5.5.320.0050.02317.61
5.5.310.0030.02617.61
5.5.300.0020.04217.67
5.5.290.0070.03917.64
5.5.280.0030.03117.46
5.5.270.0030.02617.54
5.5.260.0070.03717.61
5.5.250.0080.04617.60
5.5.240.0030.04017.37
5.5.230.0070.04517.34
5.5.220.0040.04517.25
5.5.210.0070.02817.39
5.5.200.0050.02517.19
5.5.190.0050.04317.19
5.5.180.0050.02917.29
5.5.170.0000.01114.45
5.5.160.0050.02817.21
5.5.150.0050.03017.40
5.5.140.0080.02517.20
5.5.130.0050.03717.30
5.5.120.0030.03217.25
5.5.110.0070.02817.42
5.5.100.0020.03617.30
5.5.90.0070.02217.32
5.5.80.0050.04417.17
5.5.70.0070.02517.33
5.5.60.0040.03617.20
5.5.50.0080.03217.33
5.5.40.0070.04217.32
5.5.30.0030.04317.24
5.5.20.0050.04517.32
5.5.10.0020.03117.19
5.5.00.0070.02517.27
5.4.450.0110.02115.33
5.4.440.0060.04115.33
5.4.430.0040.02115.37
5.4.420.0000.02715.41
5.4.410.0050.04115.21
5.4.400.0050.03815.04
5.4.390.0080.02515.27
5.4.380.0020.04215.25
5.4.370.0030.02614.92
5.4.360.0030.03115.26
5.4.350.0080.04015.13
5.4.340.0020.02815.15
5.4.330.0000.01211.10
5.4.320.0030.04715.23
5.4.310.0050.03315.12
5.4.300.0050.03515.33
5.4.290.0090.03715.19
5.4.280.0030.04214.99
5.4.270.0050.02414.97
5.4.260.0030.03514.93
5.4.250.0030.02715.09
5.4.240.0030.04015.29
5.4.230.0030.04615.08
5.4.220.0030.03015.09
5.4.210.0070.03314.97
5.4.200.0050.04315.16
5.4.190.0050.04315.18
5.4.180.0070.03415.07
5.4.170.0070.03815.15
5.4.160.0050.03315.28
5.4.150.0040.02515.11
5.4.140.0070.03413.91
5.4.130.0030.03713.89
5.4.120.0050.02513.73
5.4.110.0050.03613.75
5.4.100.0050.02813.89
5.4.90.0090.03713.75
5.4.80.0040.04013.83
5.4.70.0070.03813.78
5.4.60.0070.03613.88
5.4.50.0000.02613.90
5.4.40.0020.02413.75
5.4.30.0100.03813.66
5.4.20.0030.04013.81
5.4.10.0050.02313.83
5.4.00.0020.04713.63
5.3.290.0030.03112.87
5.3.280.0080.04012.67
5.3.270.0050.03212.69
5.3.260.0020.02812.73
5.3.250.0030.03712.84
5.3.240.0000.04512.71
5.3.230.0100.02312.70
5.3.220.0080.04012.69
5.3.210.0100.03212.62
5.3.200.0070.03412.60
5.3.190.0030.04312.67
5.3.180.0010.03412.68
5.3.170.0020.03512.64
5.3.160.0050.02712.56
5.3.150.0000.03012.72
5.3.140.0090.02812.73
5.3.130.0050.02912.60
5.3.120.0030.03312.74
5.3.110.0030.04312.69
5.3.100.0050.02812.40
5.3.90.0030.03112.24
5.3.80.0030.02412.37
5.3.70.0040.03912.35
5.3.60.0040.02412.39
5.3.50.0080.01812.36
5.3.40.0060.03312.32
5.3.30.0070.02212.24
5.3.20.0020.03012.20
5.3.10.0070.03611.94
5.3.00.0050.04112.11
5.2.170.0000.03711.10
5.2.160.0030.05011.15
5.2.150.0000.06711.16
5.2.140.0030.05311.22
5.2.130.0000.06711.18
5.2.120.0070.04011.17
5.2.110.0070.06011.12
5.2.100.0070.05311.18
5.2.90.0070.05311.18
5.2.80.0000.03711.00
5.2.70.0130.05011.14
5.2.60.0030.03711.13
5.2.50.0100.06011.04
5.2.40.0130.05310.90
5.2.30.0030.04310.88
5.2.20.0000.05011.04
5.2.10.0000.05310.89
5.2.00.0000.05310.88
5.1.60.0070.04710.26
5.1.50.0030.02710.26
5.1.40.0030.05310.26
5.1.30.0030.05010.41
5.1.20.0070.05010.46
5.1.10.0000.05310.26
5.1.00.0000.04710.26
5.0.50.0030.02710.26
5.0.40.0000.04310.26
5.0.30.0100.05310.26
5.0.20.0030.04010.26
5.0.10.0000.02010.26
5.0.00.0100.05010.26
4.4.90.0070.03310.26
4.4.80.0070.03310.26
4.4.70.0030.02710.26
4.4.60.0000.03710.26
4.4.50.0030.03710.26
4.4.40.0070.03010.26
4.4.30.0030.03010.26
4.4.20.0030.01710.26
4.4.10.0030.02010.26
4.4.00.0030.02310.26
4.3.110.0000.03710.26
4.3.100.0000.02010.26
4.3.90.0070.02010.26
4.3.80.0000.03710.26
4.3.70.0030.02710.26
4.3.60.0000.02010.26
4.3.50.0000.03710.26
4.3.40.0000.05010.26
4.3.30.0000.03310.26
4.3.20.0030.02310.26
4.3.10.0070.01310.26
4.3.00.0030.03310.26

preferences:
51.31 ms | 400 KiB | 5 Q