3v4l.org

run code in 300+ PHP versions simultaneously
<?php if(isset($_POST["submit"])) { // if submitted assign variables values $low = $_POST["lowNum"]; $highLimit = $_POST["highNum"]; $countLines = 0; $sum_ev = 0; $sum_od = 0; $sum_prm = 0; $constant_prm; } // Function for Prime Numbers Queries function primePrint() { echo "#==================Prime Numbers=========================#"; global $low, $highLimit, $lowLimit, $countLines, $sum_prm; for( $lowLimit = $low; $lowLimit <= $highLimit; $lowLimit++ ) { for( $constant_prm = 2; $constant_prm <= $lowLimit - 1; $constant_prm++ ) { if( $lowLimit % $constant_prm == 0 ) { break; } } if( $constant_prm == $lowLimit ) { $countLines++; echo "<br>"."Prime Number ".$countLines." : ".$lowLimit; $sum_prm = $sum_prm + $lowLimit; } } echo "<br>"; echo "<strong>Total Prime Numbers Count is : </strong>".$countLines; echo "<br>"; echo "<strong>Total Prime Numbers Summation is : </strong>".$sum_prm; echo "<br>"; echo "#=====================================================#"; } // Function for Even Numbers Queries function evenPrint() { echo "#==================Even Numbers=========================#"; global $low, $highLimit, $lowLimit, $countLines, $sum_ev; for( $lowLimit = $low; $lowLimit <= $highLimit; $lowLimit++ ) { if( $lowLimit % 2 == 0 ) { $countLines++; echo "<br>"."Even Number ".$countLines." : ".$lowLimit; $sum_ev = $sum_ev + $lowLimit; } } echo "<br>"; echo "<strong>Total Even Numbers Count is : </strong>".$countLines; echo "<br>"; echo "<strong>Total Even Numbers Summation is : </strong>".$sum_ev; echo "<br>"; echo "#=====================================================#"; } // Function for Odd Numbers Queries function oddPrint() { echo "#==================Odd Numbers=========================#"; global $low, $highLimit, $lowLimit, $countLines, $sum_od; for( $lowLimit = $low, $countLines = 0; $lowLimit <= $highLimit; $lowLimit++ ) { if( $lowLimit % 2 > 0 ) { $countLines++; echo "<br>"."Odd Number ".$countLines." : ".$lowLimit; $sum_od = $sum_od + $lowLimit; } } echo "<br>"; echo "<strong>Total Odd Numbers Count is : </strong>".$countLines; echo "<br>"; echo "<strong>Total Odd Numbers Summation is : </strong>".$sum_od; echo "<br>"; echo "#=====================================================#"; } ?> <?php // Form to get inputs echo "<form action='assignment-2.php' method='post'>"; echo "Enter the range of numbers to find prime, even and odd numbers >>"; echo "<br>"; echo "<br>"; echo "Enter the lower range number : "."<input type='text' name='lowNum'>"; echo "<br>"; echo "Enter the higher range number : "."<input type='text' name='highNum'>"; echo "<br>"; echo "<input type='submit' name='submit' value='Submit'>"; echo "</form>"; ?> <?php echo "<br>"; if(isset($_POST["submit"])) { // if submitted then call the functions primePrint(); echo "<br>"; evenPrint(); echo "<br>"; oddPrint(); } ?>

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.0130.00618.55
8.3.50.0150.00017.94
8.3.40.0120.00318.75
8.3.30.0030.01819.01
8.3.20.0040.00420.16
8.3.10.0080.00020.41
8.3.00.0080.00019.79
8.2.180.0030.01618.16
8.2.170.0120.00322.96
8.2.160.0030.01020.39
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0020.00526.16
8.2.120.0080.00022.09
8.2.110.0070.00321.12
8.2.100.0110.00018.09
8.2.90.0050.00319.22
8.2.80.0050.00317.97
8.2.70.0030.00617.63
8.2.60.0000.00817.93
8.2.50.0000.00918.07
8.2.40.0050.00318.09
8.2.30.0000.01019.21
8.2.20.0000.00717.61
8.2.10.0060.00318.05
8.2.00.0030.00617.73
8.1.270.0060.00323.83
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0100.00021.43
8.1.230.0040.00817.83
8.1.220.0050.00317.74
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0040.00417.23
8.1.180.0000.00818.10
8.1.170.0030.00618.54
8.1.160.0040.00422.05
8.1.150.0040.00418.78
8.1.140.0000.00717.42
8.1.130.0030.00317.73
8.1.120.0000.00717.45
8.1.110.0000.00817.44
8.1.100.0050.00217.32
8.1.90.0030.00317.34
8.1.80.0040.00417.30
8.1.70.0000.00717.37
8.1.60.0000.00817.52
8.1.50.0040.00417.40
8.1.40.0030.00617.55
8.1.30.0090.00017.53
8.1.20.0040.00417.53
8.1.10.0080.00017.59
8.1.00.0030.00617.34
8.0.300.0090.00018.77
8.0.290.0040.00416.63
8.0.280.0000.00718.45
8.0.270.0040.00417.31
8.0.260.0000.00618.34
8.0.250.0070.00016.97
8.0.240.0030.00316.95
8.0.230.0030.00316.96
8.0.220.0000.00716.80
8.0.210.0000.00716.79
8.0.200.0070.00016.93
8.0.190.0080.00016.88
8.0.180.0040.00416.93
8.0.170.0040.00416.91
8.0.160.0040.00416.82
8.0.150.0000.00716.87
8.0.140.0000.00716.84
8.0.130.0030.00313.20
8.0.120.0000.00816.88
8.0.110.0040.00416.77
8.0.100.0040.00416.70
8.0.90.0000.00716.77
8.0.80.0120.00316.85
8.0.70.0040.00416.74
8.0.60.0040.00416.86
8.0.50.0040.00416.83
8.0.30.0120.00917.26
8.0.20.0130.01017.40
8.0.10.0000.00817.09
8.0.00.0070.01116.68
7.4.330.0030.00315.03
7.4.320.0000.00616.40
7.4.300.0060.00016.62
7.4.290.0060.00016.63
7.4.280.0040.00416.46
7.4.270.0030.00316.58
7.4.260.0080.00016.50
7.4.250.0000.00716.43
7.4.240.0050.00216.44
7.4.230.0000.00716.68
7.4.220.0160.00316.51
7.4.210.0070.00716.57
7.4.200.0070.00016.66
7.4.160.0080.00816.67
7.4.150.0090.00917.40
7.4.140.0130.00517.86
7.4.130.0170.00616.48
7.4.120.0160.00516.54
7.4.110.0080.00816.63
7.4.100.0120.00616.52
7.4.90.0070.01116.57
7.4.80.0170.00416.65
7.4.70.0100.00716.28
7.4.60.0070.01016.38
7.4.50.0000.00816.32
7.4.40.0110.00616.69
7.4.30.0100.00716.60
7.4.00.0070.00715.07
7.3.330.0000.00613.29
7.3.320.0060.00013.07
7.3.310.0040.00416.14
7.3.300.0060.00016.16
7.3.290.0100.00316.25
7.3.280.0090.00716.32
7.3.270.0000.01717.40
7.3.260.0170.00016.53
7.3.250.0130.00816.53
7.3.240.0120.00816.63
7.3.230.0090.00916.56
7.3.210.0080.00816.27
7.3.200.0070.01119.39
7.3.190.0130.00316.21
7.3.180.0120.01016.15
7.3.170.0140.00316.27
7.3.160.0090.00616.26
7.3.00.0080.00416.33
7.2.330.0100.00716.51
7.2.320.0060.01216.40
7.2.310.0030.01916.31
7.2.300.0130.00416.43
7.2.290.0060.01516.69
7.2.130.0120.00316.62
7.2.120.0030.00716.74
7.2.110.0080.00316.79
7.2.100.0030.00516.73
7.2.90.0040.00816.66
7.2.80.0090.00316.43
7.2.70.0070.00716.83
7.2.60.0070.00316.68
7.2.50.0000.00916.73
7.2.40.0040.00816.73
7.2.30.0080.00816.80
7.2.20.0070.00316.71
7.2.10.0040.00716.84
7.2.00.0020.01018.07
7.1.250.0130.00315.55
7.1.240.0060.00315.40
7.1.230.0070.00715.52
7.1.220.0030.01015.36
7.1.210.0090.00315.73
7.1.200.0080.00415.40
7.1.190.0000.01215.86
7.1.180.0070.00315.38
7.1.170.0110.00715.33
7.1.160.0090.00315.20
7.1.150.0080.00615.59
7.1.140.0070.00415.39
7.1.130.0120.00315.59
7.1.120.0050.00515.64
7.1.110.0140.00015.71
7.1.100.0010.00916.83
7.1.90.0070.00315.68
7.1.80.0130.00315.32
7.1.70.0030.00716.21
7.1.60.0120.00517.45
7.1.50.0030.01116.06
7.1.40.0000.01215.66
7.1.30.0060.00315.57
7.1.20.0110.00415.38
7.1.10.0060.00315.73
7.1.00.0080.03719.09
7.0.330.0040.00415.29
7.0.320.0070.00315.17
7.0.310.0030.01015.11
7.0.300.0060.01015.08
7.0.290.0120.00315.26
7.0.280.0040.00715.04
7.0.270.0030.00915.15
7.0.260.0030.01015.01
7.0.250.0000.01115.13
7.0.240.0080.00615.12
7.0.230.0130.00315.20
7.0.220.0090.00315.27
7.0.210.0060.00615.03
7.0.200.0030.00715.87
7.0.190.0130.00315.28
7.0.180.0070.00315.11
7.0.170.0070.00714.89
7.0.160.0000.00715.24
7.0.150.0060.00915.31
7.0.140.0020.04218.69
7.0.130.0030.00715.01
7.0.120.0040.00815.23
7.0.110.0070.00415.07
7.0.100.0100.00314.89
7.0.90.0000.01015.03
7.0.80.0000.00815.39
7.0.70.0050.00315.23
7.0.60.0050.02017.66
7.0.50.0020.04816.66
7.0.40.0060.02616.68
7.0.30.0120.02416.71
7.0.20.0130.02516.83
7.0.10.0040.02716.79
7.0.00.0040.03016.66
5.6.380.0040.00814.26
5.6.370.0080.00313.94
5.6.360.0000.00814.36
5.6.350.0040.00914.13
5.6.340.0070.00714.46
5.6.330.0070.00714.23
5.6.320.0030.01014.20
5.6.310.0060.00614.38
5.6.300.0060.00914.35
5.6.290.0000.01114.14
5.6.280.0080.03917.63
5.6.270.0100.00314.59
5.6.260.0000.01314.36
5.6.250.0090.00614.22
5.6.240.0040.00814.25
5.6.230.0040.01114.43
5.6.220.0040.00414.24
5.6.210.0070.02717.58
5.6.200.0090.04216.32
5.6.190.0060.03417.25
5.6.180.0280.03517.31
5.6.170.0210.04517.36
5.6.160.0020.05117.24
5.6.150.0070.04416.19
5.6.140.0020.02416.27
5.6.130.0100.03816.00
5.6.120.0070.03717.59
5.6.110.0120.04017.71
5.6.100.0060.04617.66
5.6.90.0030.03717.63
5.6.80.0020.02717.34
5.6.70.0090.00314.22
5.6.60.0030.00714.28
5.6.50.0110.00414.24
5.6.40.0000.01614.04
5.6.30.0100.00014.15
5.6.20.0030.00914.48
5.6.10.0060.00914.26
5.6.00.0030.01014.14
5.5.380.0080.00311.18
5.5.370.0060.00611.18
5.5.360.0040.00411.18
5.5.350.0120.04015.79
5.5.340.0050.02714.63
5.5.330.0070.03515.76
5.5.320.0150.02215.79
5.5.310.0150.02715.76
5.5.300.0070.03314.58
5.5.290.0030.04514.55
5.5.280.0050.02815.99
5.5.270.0080.04715.91
5.5.260.0070.04116.08
5.5.250.0100.02015.90
5.5.240.0110.04015.68
5.5.230.0030.00311.18
5.5.220.0060.00011.18
5.5.210.0060.00011.18
5.5.200.0000.01011.18
5.5.190.0040.00411.18
5.5.180.0000.00811.18
5.5.170.0040.00811.18
5.5.160.0040.00411.18
5.5.150.0000.00611.18
5.5.140.0000.01011.18
5.5.130.0000.00811.18
5.5.120.0040.00411.18
5.5.110.0080.00411.18
5.5.100.0000.01011.18
5.5.90.0030.00611.18
5.5.80.0030.00711.18
5.5.70.0040.00411.18
5.5.60.0000.01011.22
5.5.50.0000.01011.18
5.5.40.0050.00311.18
5.5.30.0050.00311.18
5.5.20.0050.00611.18
5.5.10.0070.00311.18
5.5.00.0000.00611.18
5.4.450.0230.03115.38
5.4.440.0530.03015.28
5.4.430.0430.03015.38
5.4.420.0470.02915.36
5.4.410.0360.03315.18
5.4.400.0510.03115.24
5.4.390.0540.03015.17
5.4.380.0170.03414.86
5.4.370.0210.02814.96
5.4.360.0120.03315.01
5.4.350.0250.03214.94
5.4.340.0220.03215.01
5.4.330.0000.00711.18
5.4.320.0040.02611.85
5.4.310.0040.03111.84
5.4.300.0060.02411.85
5.4.290.0090.02211.85
5.4.280.0060.02411.79
5.4.270.0060.02411.79
5.4.260.0090.02411.79
5.4.250.0060.02211.79
5.4.240.0080.01811.79
5.4.230.0060.02511.79
5.4.220.0070.02011.79
5.4.210.0040.03011.79
5.4.200.0070.02511.79
5.4.190.0060.02411.79
5.4.180.0050.01911.79
5.4.170.0100.01611.79
5.4.160.0030.02511.79
5.4.150.0050.01811.79
5.4.140.0030.02111.63
5.4.130.0070.02511.62
5.4.120.0070.01711.60
5.4.110.0040.02211.60
5.4.100.0040.02211.60
5.4.90.0040.02211.60
5.4.80.0070.02311.60
5.4.70.0050.02311.60
5.4.60.0020.02211.60
5.4.50.0040.02111.60
5.4.40.0060.02411.59
5.4.30.0030.02711.59
5.4.20.0070.01911.59
5.4.10.0070.02811.59
5.4.00.0080.02311.34
5.3.290.0060.02311.99
5.3.280.0050.02311.94
5.3.270.0070.02711.95
5.3.260.0020.02511.95
5.3.250.0070.02811.95
5.3.240.0030.02911.95
5.3.230.0070.02311.94
5.3.220.0040.02911.93
5.3.210.0060.03011.93
5.3.200.0040.02211.93
5.3.190.0040.02211.93
5.3.180.0050.02111.93
5.3.170.0050.02411.92
5.3.160.0050.02811.93
5.3.150.0050.02211.92
5.3.140.0050.02711.92
5.3.130.0020.03011.92
5.3.120.0080.02311.92
5.3.110.0050.02911.92
5.3.100.0060.02811.65
5.3.90.0050.02411.64
5.3.80.0060.02211.64
5.3.70.0050.02111.64
5.3.60.0020.02211.63
5.3.50.0050.02611.61
5.3.40.0100.02711.61
5.3.30.0060.02411.59
5.3.20.0050.02111.48
5.3.10.0040.02311.46
5.3.00.0060.02411.45
5.2.170.0040.02310.21
5.2.160.0040.02110.21
5.2.150.0040.02210.21
5.2.140.0120.01610.21
5.2.130.0020.01910.19
5.2.120.0020.02310.19
5.2.110.0040.01810.19
5.2.100.0070.02510.19
5.2.90.0040.02110.19
5.2.80.0040.02110.18
5.2.70.0040.01810.18
5.2.60.0050.01510.16
5.2.50.0060.01710.15
5.2.40.0060.01710.13
5.2.30.0040.01910.12
5.2.20.0050.01510.12
5.2.10.0070.01510.07
5.2.00.0070.01910.00
5.1.60.0040.0179.64
5.1.50.0060.0209.64
5.1.40.0040.0149.63
5.1.30.0020.0189.80
5.1.20.0050.0169.82
5.1.10.0020.0229.68
5.1.00.0070.0159.68
5.0.50.0060.0118.93
5.0.40.0040.0118.85
5.0.30.0050.0228.76
5.0.20.0040.0128.74
5.0.10.0070.0138.73
5.0.00.0040.0218.73
4.4.90.0030.0117.98
4.4.80.0030.0147.96
4.4.70.0020.0147.97
4.4.60.0010.0147.96
4.4.50.0020.0157.97
4.4.40.0030.0237.94
4.4.30.0050.0107.97
4.4.20.0020.0118.01
4.4.10.0020.0118.01
4.4.00.0030.0197.97
4.3.110.0020.0147.92
4.3.100.0040.0127.92
4.3.90.0040.0127.91
4.3.80.0020.0167.88
4.3.70.0040.0107.90
4.3.60.0030.0107.90
4.3.50.0020.0097.90
4.3.40.0040.0137.86
4.3.30.0010.0117.26
4.3.20.0010.0127.24
4.3.10.0040.0137.22
4.3.00.0030.0138.98

preferences:
68.67 ms | 400 KiB | 5 Q