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 { $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->years = $years; $dateObj->months = $months; $dateObj->days = $days; $dateObj->hours = $hours; $dateObj->minutes = $minutes; $dateObj->seconds = $seconds; $dateObj->dayyyy = $inbetween / 60 / 60 / 24; return $dateObj; } $str1 = "1970-01-01 + 21 sec"; $str2 = "2009-01-01 + 54612 sec"; $tempdate1 = $str1; $date1 = new DateTime($str1); $n = 0; $date2 = new DateTime($str2); $interval = $date1->diff($date2); $string1 = "(" . $interval->days . ") difference " . $interval->y . " years, " . $interval->m . " months, " . $interval->d . " days"; $mydate = dateDiff(strtotime($str1), strtotime($str2)); $string2 = "(" . $mydate->dayyyy . ") difference " . $mydate->years . " years, " . $mydate->months . " months, " . $mydate->days . " days"; if($string1 !== $string2) { echo "<span style=\"color:red;\">", $string1, " - ", $string2, "</span><br />"; // This will never run } else { echo "<span style=\"color:green;\">", $string1, " - ", $string2, "</span><br />"; } $n++; $tempdate1 = $str1 . " +" . $n . " days";

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.70.0110.00416.75
8.3.60.0060.01018.68
8.3.50.0120.00717.43
8.3.40.0090.00618.82
8.3.30.0090.00618.88
8.3.20.0000.00919.07
8.3.10.0090.00019.04
8.3.00.0060.00319.38
8.2.180.0040.01117.00
8.2.170.0120.00922.96
8.2.160.0120.00418.87
8.2.150.0000.00924.18
8.2.140.0060.00324.66
8.2.130.0050.00326.16
8.2.120.0080.00021.02
8.2.110.0090.00320.48
8.2.100.0040.00818.16
8.2.90.0080.00018.22
8.2.80.0050.00517.97
8.2.70.0090.00317.75
8.2.60.0030.00518.05
8.2.50.0040.00418.05
8.2.40.0060.00319.60
8.2.30.0000.00918.04
8.2.20.0060.00317.95
8.2.10.0050.00318.03
8.2.00.0080.00018.29
8.1.280.0100.00725.92
8.1.270.0000.00823.99
8.1.260.0040.00426.35
8.1.250.0090.00028.09
8.1.240.0090.00022.66
8.1.230.0060.00622.63
8.1.220.0040.00717.78
8.1.210.0090.00018.77
8.1.200.0030.00617.50
8.1.190.0060.00317.48
8.1.180.0040.00718.10
8.1.170.0000.00817.62
8.1.160.0050.00319.16
8.1.150.0040.00418.86
8.1.140.0040.00417.67
8.1.130.0040.00417.54
8.1.120.0000.00817.58
8.1.110.0000.00817.71
8.1.100.0000.00817.55
8.1.90.0030.00517.69
8.1.80.0040.00417.57
8.1.70.0040.00417.68
8.1.60.0000.00817.74
8.1.50.0000.00817.59
8.1.40.0000.01017.57
8.1.30.0040.00417.84
8.1.20.0050.00517.70
8.1.10.0040.00417.68
8.1.00.0060.00317.70
8.0.300.0060.00320.11
8.0.290.0050.00316.84
8.0.280.0050.00318.58
8.0.270.0040.00417.27
8.0.260.0000.00718.55
8.0.250.0080.00017.15
8.0.240.0040.00417.26
8.0.230.0030.00617.16
8.0.220.0060.00317.25
8.0.210.0040.00417.05
8.0.200.0040.00417.25
8.0.190.0000.00717.26
8.0.180.0040.00417.24
8.0.170.0030.00517.09
8.0.160.0070.00017.15
8.0.150.0000.00817.14
8.0.140.0040.00417.09
8.0.130.0000.00613.57
8.0.120.0000.01017.13
8.0.110.0080.00016.97
8.0.100.0040.00417.05
8.0.90.0030.00617.24
8.0.80.0140.00717.08
8.0.70.0050.00317.14
8.0.60.0060.00316.98
8.0.50.0030.00617.24
8.0.30.0090.01217.52
8.0.20.0110.00717.31
8.0.10.0000.00817.32
8.0.00.0120.00916.96
7.4.330.0000.00513.12
7.4.320.0030.00316.68
7.4.300.0080.00016.75
7.4.290.0040.00716.72
7.4.280.0000.00816.54
7.4.270.0080.00316.66
7.4.260.0000.00713.47
7.4.250.0040.00416.54
7.4.240.0030.00316.77
7.4.230.0040.00416.39
7.4.220.0040.01816.55
7.4.210.0060.01016.69
7.4.200.0000.00716.76
7.4.190.0030.00616.82
7.4.160.0130.00316.70
7.4.150.0130.00416.78
7.4.140.0060.01317.86
7.4.130.0150.00916.81
7.4.120.0080.00916.80
7.4.110.0180.00716.87
7.4.100.0070.01316.78
7.4.90.0140.00716.53
7.4.80.0100.00719.39
7.4.70.0030.01416.74
7.4.60.0120.00416.71
7.4.50.0030.00616.78
7.4.40.0060.01216.77
7.4.30.0090.00916.67
7.4.10.0100.01014.97
7.4.00.0070.01015.24
7.3.330.0030.00313.46
7.3.320.0030.00313.47
7.3.310.0000.00716.68
7.3.300.0070.00016.65
7.3.290.0100.00816.63
7.3.280.0180.00016.63
7.3.270.0100.00716.66
7.3.260.0110.00716.60
7.3.240.0120.01216.80
7.3.230.0120.00816.81
7.3.210.0130.00316.63
7.3.200.0120.00616.50
7.3.190.0080.00816.52
7.3.180.0080.00816.73
7.3.170.0100.01216.78
7.3.160.0130.00316.86
7.3.130.0060.00915.01
7.3.120.0080.00915.14
7.3.110.0120.00515.10
7.3.100.0050.01114.96
7.3.90.0100.00515.14
7.3.80.0040.00714.86
7.3.70.0030.01114.91
7.3.60.0020.01115.08
7.3.50.0070.00714.96
7.3.40.0110.00214.99
7.3.30.0030.01315.02
7.3.20.0040.00716.91
7.3.10.0070.00616.74
7.3.00.0060.00716.78
7.2.330.0120.00716.95
7.2.320.0080.01016.99
7.2.310.0140.00916.71
7.2.300.0140.00316.64
7.2.290.0180.00616.98
7.2.260.0130.00615.26
7.2.250.0120.00715.31
7.2.240.0070.01015.23
7.2.230.0070.01215.36
7.2.220.0080.00815.08
7.2.210.0080.00615.36
7.2.200.0060.00815.18
7.2.190.0030.01215.13
7.2.180.0050.00715.25
7.2.170.0020.01415.06
7.2.160.0100.00315.04
7.2.150.0060.00317.05
7.2.140.0100.00316.74
7.2.130.0050.00817.06
7.2.120.0020.01117.04
7.2.110.0080.00517.00
7.2.100.0100.00517.03
7.2.90.0060.00617.24
7.2.80.0020.01117.11
7.2.70.0130.00217.00
7.2.60.0020.01217.15
7.2.50.0050.01017.02
7.2.40.0080.00817.12
7.2.30.0100.00517.10
7.2.20.0060.00616.99
7.2.10.0040.01017.10
7.2.00.0070.00717.93
7.1.330.0090.00515.84
7.1.320.0030.01215.91
7.1.310.0080.00216.00
7.1.300.0100.00515.97
7.1.290.0070.00916.08
7.1.280.0050.01015.99
7.1.270.0030.00815.74
7.1.260.0060.00915.81
7.1.250.0000.01215.96
7.1.240.0070.00715.93
7.1.230.0070.00715.80
7.1.220.0090.00915.85
7.1.210.0050.00516.02
7.1.200.0000.01216.03
7.1.190.0030.00815.72
7.1.180.0030.00715.98
7.1.170.0050.00515.85
7.1.160.0060.00915.77
7.1.150.0060.00315.82
7.1.140.0040.00715.87
7.1.130.0000.01115.90
7.1.120.0030.00815.97
7.1.110.0090.00615.92
7.1.100.0020.00917.24
7.1.90.0070.00716.03
7.1.80.0070.01015.86
7.1.70.0050.00716.69
7.1.60.0080.00817.59
7.1.50.0040.01616.44
7.1.40.0030.00615.77
7.1.30.0030.01016.01
7.1.20.0000.01015.95
7.1.10.0030.00715.89
7.1.00.0020.02119.21
7.0.330.0120.00615.50
7.0.320.0030.01015.49
7.0.310.0000.01315.36
7.0.300.0080.00415.37
7.0.290.0030.01015.46
7.0.280.0040.01115.49
7.0.270.0000.01515.70
7.0.260.0060.00315.50
7.0.250.0060.00915.41
7.0.240.0100.00315.46
7.0.230.0060.01215.37
7.0.220.0060.00615.32
7.0.210.0030.01015.50
7.0.200.0020.01116.09
7.0.190.0070.00715.46
7.0.180.0130.00315.68
7.0.170.0030.00915.67
7.0.160.0000.01215.48
7.0.150.0040.01215.68
7.0.140.0030.04318.66
7.0.130.0000.00815.71
7.0.120.0020.03918.75
7.0.110.0030.00915.40
7.0.100.0190.03717.75
7.0.90.0070.04017.65
7.0.80.0060.04517.76
7.0.70.0290.04417.55
7.0.60.0030.03217.74
7.0.50.0070.02517.86
7.0.40.0080.03616.78
7.0.30.0060.03616.70
7.0.20.0070.04916.88
7.0.10.0040.04216.66
7.0.00.0080.02816.85
5.6.400.0100.00714.81
5.6.390.0060.01014.90
5.6.380.0100.00714.77
5.6.370.0090.00614.68
5.6.360.0000.01514.40
5.6.350.0090.00914.76
5.6.340.0040.01114.62
5.6.330.0000.01414.51
5.6.320.0030.01314.53
5.6.310.0040.01114.42
5.6.300.0040.01114.68
5.6.290.0030.01014.82
5.6.280.0100.03617.82
5.6.270.0030.01314.41
5.6.260.0030.00914.71
5.6.250.0050.04617.77
5.6.240.0080.04517.65
5.6.230.0050.03617.69
5.6.220.0080.04117.43
5.6.210.0110.03817.64
5.6.200.0110.04217.78
5.6.190.0060.03917.88
5.6.180.0100.04417.58
5.6.170.0080.02617.60
5.6.160.0080.04217.87
5.6.150.0030.03817.83
5.6.140.0080.04717.78
5.6.130.0030.05217.74
5.6.120.0110.02617.83
5.6.110.0070.04117.90
5.6.100.0050.02817.80
5.6.90.0110.04317.66
5.6.80.0080.03317.52
5.6.70.0070.04417.41
5.6.60.0030.03117.43
5.6.50.0020.04917.49
5.6.40.0050.03217.48
5.6.30.0100.04017.40
5.6.20.0100.03717.47
5.6.10.0070.02217.62
5.6.00.0060.02117.41
5.5.380.0030.05117.40
5.5.370.0060.03117.51
5.5.360.0050.02717.35
5.5.350.0050.03117.34
5.5.340.0070.05017.65
5.5.330.0060.02817.55
5.5.320.0030.04717.72
5.5.310.0070.03017.54
5.5.300.0050.02517.77
5.5.290.0070.02717.67
5.5.280.0020.04717.54
5.5.270.0110.04117.55
5.5.260.0060.04617.75
5.5.250.0050.04317.46
5.5.240.0070.04117.28
5.5.230.0030.02717.44
5.5.220.0050.04417.45
5.5.210.0050.04617.31
5.5.200.0070.04117.32
5.5.190.0060.03617.29
5.5.180.0090.04317.44
5.5.170.0000.01714.30
5.5.160.0030.03117.34
5.5.150.0050.02517.30
5.5.140.0020.02517.38
5.5.130.0030.02717.21
5.5.120.0090.02117.38
5.5.110.0060.02417.30
5.5.100.0110.01917.23
5.5.90.0030.02717.41
5.5.80.0020.02317.36
5.5.70.0030.02317.36
5.5.60.0070.02217.27
5.5.50.0070.02217.04
5.5.40.0030.02217.40
5.5.30.0020.02317.27
5.5.20.0030.02317.28
5.5.10.0020.02417.31
5.5.00.0080.04117.24
5.4.450.0100.03615.50
5.4.440.0050.03515.49
5.4.430.0020.02715.20
5.4.420.0030.02515.38
5.4.410.0060.04515.31
5.4.400.0050.03915.27
5.4.390.0000.03415.08
5.4.380.0030.04215.11
5.4.370.0050.02215.08
5.4.360.0030.03015.31
5.4.350.0070.01914.98
5.4.340.0030.02215.26
5.4.330.0000.01211.42
5.4.320.0030.02315.13
5.4.310.0000.02715.03
5.4.300.0040.02415.15
5.4.290.0050.02215.15
5.4.280.0020.02615.07
5.4.270.0050.02514.93
5.4.260.0040.02615.16
5.4.250.0060.01815.16
5.4.240.0080.02015.19
5.4.230.0060.01815.13
5.4.220.0030.02514.96
5.4.210.0070.01915.13
5.4.200.0020.02014.94
5.4.190.0030.02315.19
5.4.180.0070.01715.18
5.4.170.0030.02215.00
5.4.160.0030.02715.09
5.4.150.0050.03815.00
5.4.140.0080.01613.94
5.4.130.0050.02013.77
5.4.120.0020.02213.95
5.4.110.0020.02313.89
5.4.100.0020.02713.78
5.4.90.0020.02313.97
5.4.80.0070.02113.86
5.4.70.0040.02013.98
5.4.60.0030.02213.79
5.4.50.0050.02213.94
5.4.40.0040.02013.71
5.4.30.0030.02313.92
5.4.20.0060.02013.92
5.4.10.0020.02113.91
5.4.00.0050.01913.54
5.3.290.0080.02012.72
5.3.280.0040.02212.62
5.3.270.0070.02312.74
5.3.260.0080.04012.79
5.3.250.0050.03612.79
5.3.240.0060.02112.73
5.3.230.0000.02412.67
5.3.220.0030.02412.58
5.3.210.0050.02112.71
5.3.200.0050.02012.61
5.3.190.0050.01512.65
5.3.180.0030.02012.67
5.3.170.0000.02412.59
5.3.160.0020.02412.63
5.3.150.0050.02012.68
5.3.140.0050.02212.66
5.3.130.0050.01612.59
5.3.120.0030.02112.73
5.3.110.0050.01712.74
5.3.100.0000.02312.36
5.3.90.0020.02112.48
5.3.80.0020.02312.34
5.3.70.0000.02312.31
5.3.60.0020.01812.44
5.3.50.0050.02012.31
5.3.40.0050.02412.29
5.3.30.0080.01512.48
5.3.20.0030.02012.17
5.3.10.0020.02112.18
5.3.00.0030.02211.99
5.2.170.0030.02311.23
5.2.160.0030.02311.23
5.2.150.0000.02711.23
5.2.140.0030.02311.23
5.2.130.0000.02711.23
5.2.120.0000.02311.27
5.2.110.0000.02711.23
5.2.100.0030.02311.26
5.2.90.0030.02311.23
5.2.80.0070.02011.26
5.2.70.0070.02011.27
5.2.60.0070.02011.23
5.2.50.0100.03711.23
5.2.40.0030.02311.23
5.2.30.0000.05711.23
5.2.20.0070.02711.23
5.2.10.0070.02311.23
5.2.00.0000.04011.23
5.1.60.0030.05711.23
5.1.50.0100.03311.23
5.1.40.0000.04311.23
5.1.30.0070.05011.23
5.1.20.0030.05711.23
5.1.10.0000.05311.23
5.1.00.0100.04311.23
5.0.50.0070.04011.23
5.0.40.0070.03311.23
5.0.30.0000.05711.23
5.0.20.0070.02011.23
5.0.10.0030.04311.23
5.0.00.0030.05711.23
4.4.90.0030.01311.23
4.4.80.0000.01311.23
4.4.70.0030.01011.23
4.4.60.0000.02011.23
4.4.50.0000.01311.23
4.4.40.0030.05011.23
4.4.30.0000.02011.23
4.4.20.0070.03011.23
4.4.10.0100.02711.23
4.4.00.0000.04711.23
4.3.110.0000.03311.23
4.3.100.0000.03711.23
4.3.90.0000.03311.23
4.3.80.0000.05311.23
4.3.70.0000.03711.23
4.3.60.0030.03311.23
4.3.50.0000.03711.23
4.3.40.0000.03311.23
4.3.30.0000.03311.23
4.3.20.0000.03711.23
4.3.10.0030.01711.23
4.3.00.0000.01711.23

preferences:
45.63 ms | 401 KiB | 5 Q