3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { const PER_MONTH = 200000; /** * Get the number of working days in the current month. * * @return int */ private function getWorkingDaysThisMonth() { $working_days = 0; for ($i = 1; $i < date('t') + 1; $i++) { $thisDay = date('D', strtotime(date('Y-m-' . $i))); if (!($thisDay == 'Sun' || $thisDay == 'Sat')) { $working_days++; } } return $working_days; } /** * Get the number of records added to the site per second. * * @return float */ private function getRecordsPerSecond() { // Get the number of seconds in the current month // 9 is the number of working hours in one day (0830-1730). $seconds_current_month = $this->getWorkingDaysThisMonth() * 9 * 60 * 60; // Get the number of records per second $records_per_second = round(self::PER_MONTH / $seconds_current_month, 4); return $records_per_second; } /** * Get the number of rates added to the site to date. * * @param int $records_per_second The rate of records generated per second. * @return float|int */ private function getRatesToDate($records_per_second) { // Get the UNIX timestamp of the start of 2012-05-01 $start_month = strtotime('2012-05-01 00:00:00'); // Get the UNIX timestamp of the start of this month $start_of_current_month = strtotime(date('Y-m-01 00:00:00', time())); // First of current month // Set how many rates per month $counter = 0; // Work out where we are upto already while($start_month < $start_of_current_month) { // Add on historical months of rates $counter += self::PER_MONTH; $start_month = strtotime("+1 month", $start_month); } // Get the number of seconds that have passed in this month $seconds_elapsed_this_month = time() - $start_of_current_month; // Add on the remained of this month $counter += ceil($seconds_elapsed_this_month * $records_per_second); return $counter; } public function get() { $s = $this->getRecordsPerSecond(); return array( 'per_second' => $s, 'counter' => $this->getRatesToDate($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)
7.4.00.0110.00414.59
7.3.120.0030.01414.90
7.3.110.0100.00714.53
7.3.100.0000.01714.67
7.3.90.0000.01414.74
7.3.80.0030.01014.79
7.3.70.0070.00314.24
7.3.60.0040.00714.59
7.3.50.0060.00914.64
7.3.40.0070.01114.61
7.3.30.0080.00314.47
7.3.20.0070.00316.48
7.3.10.0040.01016.52
7.3.00.0070.00816.46
7.2.250.0040.01214.82
7.2.240.0130.00614.75
7.2.230.0130.00314.83
7.2.220.0030.00714.88
7.2.210.0120.00414.68
7.2.200.0070.01114.44
7.2.190.0030.01014.93
7.2.180.0100.00714.68
7.2.170.0060.00914.94
7.2.130.0080.00816.89
7.2.120.0110.00316.49
7.2.110.0110.00716.59
7.2.100.0110.00416.52
7.2.90.0100.00016.48
7.2.80.0030.00916.68
7.2.70.0060.00916.93
7.2.60.0080.00616.72
7.2.50.0050.01516.71
7.2.40.0100.01316.79
7.2.30.0040.01516.73
7.2.20.0040.00716.82
7.2.10.0030.01416.88
7.2.00.0060.01018.12
7.1.330.0140.00015.60
7.1.320.0100.00315.45
7.1.310.0070.00715.79
7.1.300.0040.01215.27
7.1.290.0110.00415.58
7.1.280.0000.01115.61
7.1.270.0030.00815.50
7.1.260.0040.00415.71
7.1.250.0000.01315.46
7.1.200.0070.00715.52
7.1.100.0000.01117.64
7.1.70.0020.00516.73
7.1.60.0090.01619.82
7.1.50.0310.00734.75
7.1.00.0000.05022.57
7.0.200.0040.00416.55
7.0.140.0070.07022.09
7.0.90.0100.08021.81
7.0.80.0070.05721.80
7.0.70.0130.06321.69
7.0.60.0030.08721.77
7.0.50.0070.08322.11
7.0.40.0130.07020.11
7.0.30.0130.05320.15
7.0.20.0030.05020.00
7.0.10.0030.08720.07
7.0.00.0100.08020.09
5.6.280.0000.07721.12
5.6.240.0100.08020.76
5.6.230.0200.07320.52
5.6.220.0070.05020.50
5.6.210.0000.08320.57
5.6.200.0070.07021.11
5.6.190.0070.07720.96
5.6.180.0200.07321.08
5.6.170.0030.05021.13
5.6.160.0130.04021.14
5.6.150.0070.07721.05
5.6.140.0030.07321.07
5.6.130.0000.07021.01
5.6.120.0070.04021.06
5.6.110.0000.05020.93
5.6.100.0070.08721.04
5.6.90.0100.05321.04
5.6.80.0100.07020.41
5.6.70.0070.05720.52
5.6.60.0070.08320.43
5.6.50.0070.07020.46
5.6.40.0070.08020.32
5.6.30.0100.05320.50
5.6.20.0100.07320.42
5.6.10.0070.04720.30
5.6.00.0070.05720.39
5.5.380.0170.07320.46
5.5.370.0030.08320.58
5.5.360.0030.05720.50
5.5.350.0030.07720.47
5.5.340.0070.05720.93
5.5.330.0170.03720.73
5.5.320.0030.05720.89
5.5.310.0100.08020.70
5.5.300.0100.08320.88
5.5.290.0170.07720.82
5.5.280.0070.05020.88
5.5.270.0030.04320.89
5.5.260.0170.08320.91
5.5.250.0070.06020.59
5.5.240.0170.07020.23
5.5.230.0100.07320.14
5.5.220.0170.06720.27
5.5.210.0200.06720.18
5.5.200.0100.07020.10
5.5.190.0130.07320.13
5.5.180.0100.07020.16
5.5.160.0130.07020.25
5.5.150.0100.04320.14
5.5.140.0070.04320.25
5.5.130.0200.05720.24
5.5.120.0130.06720.09
5.5.110.0130.05020.27
5.5.100.0030.08319.97
5.5.90.0000.07719.96
5.5.80.0070.06720.08
5.5.70.0030.06720.01
5.5.60.0130.06720.07
5.5.50.0100.07320.07
5.5.40.0130.06320.05
5.5.30.0170.06720.07
5.5.20.0100.04320.08
5.5.10.0070.06319.97
5.5.00.0070.06320.06
5.4.450.0030.07319.56
5.4.440.0030.04319.37
5.4.430.0030.07719.22
5.4.420.0130.07319.35
5.4.410.0130.04719.24
5.4.400.0070.04719.05
5.4.390.0170.06019.21
5.4.380.0070.09319.09
5.4.370.0000.04719.16
5.4.360.0070.07319.11
5.4.350.0130.06719.13
5.4.340.0100.08018.85
5.4.320.0130.07318.87
5.4.310.0030.04719.16
5.4.300.0170.06319.03
5.4.290.0100.07719.13
5.4.280.0100.07319.04
5.4.270.0070.03718.84
5.4.260.0030.04019.23
5.4.250.0100.07019.20
5.4.240.0100.07319.15
5.4.230.0030.06318.84
5.4.220.0070.08019.12
5.4.210.0030.07318.86
5.4.200.0070.07319.15
5.4.190.0100.03719.25
5.4.180.0070.06719.11
5.4.170.0070.03719.11
5.4.160.0100.07019.07
5.4.150.0100.06719.19
5.4.140.0030.05016.41
5.4.130.0170.06016.34
5.4.120.0130.06016.42
5.4.110.0030.07316.33
5.4.100.0070.07016.36
5.4.90.0100.05716.47
5.4.80.0070.03316.49
5.4.70.0130.06716.41
5.4.60.0070.07316.34
5.4.50.0200.05316.33
5.4.40.0070.07016.41
5.4.30.0070.04316.33
5.4.20.0070.06716.25
5.4.10.0070.04016.44
5.4.00.0070.06715.87
5.3.290.0100.04314.63
5.3.280.0070.04014.53
5.3.270.0070.04714.68
5.3.260.0100.05314.62
5.3.250.0100.05714.64
5.3.240.0070.08014.60
5.3.230.0100.03714.70
5.3.220.0070.06714.67
5.3.210.0100.06314.63
5.3.200.0070.04314.71
5.3.190.0030.08014.56
5.3.180.0100.03714.62
5.3.170.0000.07714.57
5.3.160.0130.03314.71
5.3.150.0130.07014.50
5.3.140.0070.07314.69
5.3.130.0000.05314.55
5.3.120.0000.06714.54
5.3.110.0070.07314.54
5.3.100.0130.06314.04
5.3.90.0030.04314.09
5.3.80.0000.06314.02
5.3.70.0070.07314.02
5.3.60.0100.06314.00
5.3.50.0100.06313.97
5.3.40.0070.07313.98
5.3.30.0170.05713.89
5.3.20.0000.04313.77
5.3.10.0100.07013.79
5.3.00.0030.07313.64
5.2.170.0100.05711.25
5.2.160.0100.05711.16
5.2.150.0030.03711.17
5.2.140.0030.05711.21
5.2.130.0100.05311.18
5.2.120.0070.05711.09
5.2.110.0100.04711.20
5.2.100.0100.04311.10
5.2.90.0070.03011.13
5.2.80.0030.04311.21
5.2.70.0070.06011.19
5.2.60.0030.05011.15
5.2.50.0100.05711.14
5.2.40.0100.06010.92
5.2.30.0100.05010.91
5.2.20.0030.03311.11
5.2.10.0070.03710.88
5.2.00.0030.06710.74
5.1.60.0070.03710.09
5.1.50.0030.03310.09
5.1.40.0070.04010.08
5.1.30.0070.05710.49
5.1.20.0100.05010.29
5.1.10.0000.03710.07
5.1.00.0070.0539.93
5.0.50.0030.0379.68
5.0.40.0070.0439.68
5.0.30.0070.0379.68
5.0.20.0000.0409.68
5.0.10.0000.0279.68
5.0.00.0030.0639.68
4.4.90.0000.0209.68
4.4.80.0030.0339.68
4.4.70.0000.0179.68
4.4.60.0030.0339.68
4.4.50.0000.0339.68
4.4.40.0030.0509.68
4.4.30.0030.0209.68
4.4.20.0000.0379.68
4.4.10.0070.0339.68
4.4.00.0030.0509.68
4.3.110.0000.0209.68
4.3.100.0130.0209.68
4.3.90.0070.0139.68
4.3.80.0030.0579.68
4.3.70.0030.0309.68
4.3.60.0070.0279.68
4.3.50.0100.0309.68
4.3.40.0070.0379.68
4.3.30.0000.0379.68
4.3.20.0100.0139.68
4.3.10.0000.0379.68
4.3.00.0000.0379.68

preferences:
38.11 ms | 401 KiB | 5 Q