3v4l.org

run code in 300+ PHP versions simultaneously
<?php $n = (int)$_POST['n']; $r = (int)$_POST['r']; $model = $_POST['model']; function factorial($n) { if($n == 0 or $n == 1) { return 1; } else { return($n * factorial($n-1)); } } // fungsi permutasi perulangan function permutasi_perulangan($n, $r) { return(pow($n, $r)); } // fungsi permutasi tak berulang function permutasi_tak_berulang($n, $r) { return(factorial($n)/factorial($n-$r)); } ?> <html> <head> <title>Fungsi Permutasi dengan PHP</title> </head> <body> <center> <form method="post"> <table cellpadding=5 cellspacing=2 border=1> <tr> <td>Permutasi</td> <td> <select name="model"> <option value="ulang">Permutasi Perulangan</option> <option value="tidak">Permutasi Tak Berulang</option> </select> </td> </tr> <tr> <td>N</td> <td><input type=text name="n" size=5 value=<? echo $n; ?> /></td> </tr> <tr> <td>M</td> <td><input type=text name="r" size=5 value=<? echo $r; ?> /></td> </tr> <tr> <td colspan=2 align=center><input type="submit" value="Permutasi" /></td> </tr> </table> </form> <?php if(isset($n) && isset($r) && isset($model) && $n != 0 && $r != 0) { if($model == "ulang") { echo "<h2>$n<sup>$r</sup> = "; echo permutasi_perulangan($n, $r); echo "</h2>"; } else { echo "<table border=0 cellpadding=0 cellspacing=0>"; echo "<tr><td align=center style=\"border-bottom: solid #000;\"><font size=6>$n!</font></td>"; echo "<td rowspan=2 valign=middle><font size=6>&nbsp; = ". permutasi_tak_berulang($n ,$r) ."</font>"; echo "</tr>"; echo "<tr><td align=center><font size=6>$r !($n - $r)!</font></td></tr></table>"; } } ?> </center> </body> </html>

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.0150.00618.50
8.3.50.0110.00921.92
8.3.40.0120.00618.84
8.3.30.0070.00719.12
8.3.20.0050.00320.20
8.3.10.0040.00423.48
8.3.00.0000.00819.21
8.2.180.0110.00416.63
8.2.170.0120.00322.96
8.2.160.0070.01020.35
8.2.150.0140.00024.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0070.00020.86
8.2.110.0040.00422.16
8.2.100.0040.00818.03
8.2.90.0040.00419.34
8.2.80.0040.00417.97
8.2.70.0030.00617.75
8.2.60.0110.00017.93
8.2.50.0080.00018.07
8.2.40.0030.00619.95
8.2.30.0030.00618.47
8.2.20.0000.00717.78
8.2.10.0040.00418.23
8.2.00.0040.00417.91
8.1.280.0040.01225.92
8.1.270.0000.00823.74
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0060.00324.01
8.1.230.0050.00519.18
8.1.220.0080.00017.74
8.1.210.0050.00318.77
8.1.200.0060.00317.22
8.1.190.0030.00617.35
8.1.180.0040.00418.10
8.1.170.0030.00618.64
8.1.160.0070.00022.10
8.1.150.0040.00418.70
8.1.140.0040.00417.48
8.1.130.0030.00317.83
8.1.120.0000.00717.40
8.1.110.0050.00217.48
8.1.100.0000.00817.53
8.1.90.0030.00717.40
8.1.80.0040.00417.40
8.1.70.0000.00717.45
8.1.60.0040.00717.66
8.1.50.0030.00517.57
8.1.40.0000.00817.46
8.1.30.0080.00017.65
8.1.20.0040.00417.70
8.1.10.0080.00017.60
8.1.00.0060.00617.51
8.0.300.0000.00718.77
8.0.290.0050.00216.98
8.0.280.0040.00418.49
8.0.270.0040.00417.22
8.0.260.0030.00317.34
8.0.250.0030.00316.95
8.0.240.0030.00317.05
8.0.230.0070.00017.00
8.0.220.0000.00716.96
8.0.210.0070.00016.99
8.0.200.0060.00017.05
8.0.190.0040.00416.97
8.0.180.0000.00717.05
8.0.170.0000.00817.02
8.0.160.0000.00717.02
8.0.150.0000.00716.93
8.0.140.0000.00716.86
8.0.130.0000.00613.38
8.0.120.0070.00016.86
8.0.110.0000.00717.02
8.0.100.0040.00416.89
8.0.90.0050.00316.89
8.0.80.0120.00916.89
8.0.70.0000.00716.95
8.0.60.0000.00716.85
8.0.50.0050.00216.91
8.0.30.0110.01117.15
8.0.20.0120.00917.40
8.0.10.0080.00016.93
8.0.00.0030.01416.95
7.4.330.0000.00615.00
7.4.320.0070.00016.62
7.4.300.0030.00316.53
7.4.290.0000.00716.47
7.4.280.0030.00616.61
7.4.270.0030.00516.50
7.4.260.0030.00816.67
7.4.250.0070.00016.66
7.4.240.0020.00616.54
7.4.230.0070.00016.36
7.4.220.0140.00516.66
7.4.210.0070.00716.59
7.4.200.0000.00716.67
7.4.160.0110.00416.70
7.4.150.0170.00717.40
7.4.140.0110.00817.86
7.4.130.0100.00816.58
7.4.120.0120.00516.48
7.4.110.0100.01016.46
7.4.100.0030.01516.62
7.4.90.0040.01416.49
7.4.80.0130.01319.39
7.4.70.0100.00616.63
7.4.60.0100.00716.58
7.4.50.0040.00016.25
7.4.40.0070.01016.59
7.4.30.0080.00816.45
7.4.10.0110.00714.76
7.4.00.0070.01114.84
7.3.330.0060.00013.32
7.3.320.0030.00313.41
7.3.310.0040.00416.43
7.3.300.0030.00316.29
7.3.290.0030.01516.41
7.3.280.0080.00816.43
7.3.270.0110.00617.40
7.3.260.0090.01016.39
7.3.250.0080.01216.46
7.3.240.0030.01516.40
7.3.230.0030.01316.39
7.3.210.0070.01116.43
7.3.200.0070.01019.39
7.3.190.0070.01316.46
7.3.180.0100.00616.50
7.3.170.0090.01216.39
7.3.160.0130.00316.40
7.3.130.0100.00714.96
7.3.120.0060.01214.94
7.3.110.0050.01214.88
7.3.100.0080.00614.79
7.3.90.0030.00914.83
7.3.80.0070.00714.87
7.3.70.0040.00814.72
7.3.60.0060.00714.88
7.3.50.0050.00714.86
7.3.40.0080.00814.75
7.3.30.0020.01114.79
7.3.20.0070.00516.53
7.3.10.0030.01016.63
7.3.00.0050.00916.52
7.2.330.0120.00616.82
7.2.320.0000.01716.75
7.2.310.0140.00316.56
7.2.300.0070.01016.46
7.2.290.0120.00616.77
7.2.260.0050.01015.09
7.2.250.0040.01215.24
7.2.240.0070.00914.99
7.2.230.0070.00715.10
7.2.220.0030.01215.04
7.2.210.0030.01215.12
7.2.200.0100.00315.11
7.2.190.0090.00415.04
7.2.180.0020.01215.20
7.2.170.0090.00715.08
7.2.160.0060.00915.15
7.2.150.0070.00416.78
7.2.140.0000.01417.03
7.2.130.0030.01016.80
7.2.120.0100.00016.70
7.2.110.0130.00016.83
7.2.100.0080.00416.88
7.2.90.0000.01416.94
7.2.80.0070.00716.93
7.2.70.0040.01117.08
7.2.60.0030.00916.85
7.2.50.0110.00716.64
7.2.40.0000.01517.00
7.2.30.0030.01316.57
7.2.20.0030.00917.08
7.2.10.0030.00916.92
7.2.00.0050.00918.08
7.1.330.0040.01115.88
7.1.320.0060.00915.70
7.1.310.0050.00915.77
7.1.300.0080.00715.79
7.1.290.0080.00615.60
7.1.280.0050.00615.58
7.1.270.0060.00615.58
7.1.260.0060.00615.66
7.1.250.0100.00315.68
7.1.240.0040.00415.82
7.1.230.0060.00615.81
7.1.220.0040.01115.88
7.1.210.0030.00715.61
7.1.200.0060.00615.70
7.1.190.0120.00315.66
7.1.180.0100.00315.55
7.1.170.0070.00715.91
7.1.160.0060.00615.66
7.1.150.0000.00915.65
7.1.140.0120.00315.55
7.1.130.0090.00415.75
7.1.120.0070.00715.70
7.1.110.0100.00315.50
7.1.100.0060.01016.78
7.1.90.0000.01115.52
7.1.80.0120.00015.60
7.1.70.0000.00816.36
7.1.60.0040.00817.66
7.1.50.0050.00716.38
7.1.40.0070.00715.47
7.1.30.0030.01015.52
7.1.20.0100.00315.49
7.1.10.0030.01015.53
7.1.00.0030.04419.09
7.0.330.0080.00315.27
7.0.320.0080.00415.33
7.0.310.0000.00915.26
7.0.300.0050.00315.32
7.0.290.0030.01015.47
7.0.280.0040.00814.94
7.0.270.0130.00015.46
7.0.260.0060.00315.21
7.0.250.0030.00915.14
7.0.240.0000.00915.50
7.0.230.0090.00315.49
7.0.220.0000.01315.26
7.0.210.0070.00415.19
7.0.200.0030.00515.94
7.0.190.0030.01315.33
7.0.180.0060.00715.51
7.0.170.0090.00015.19
7.0.160.0030.01015.57
7.0.150.0100.00315.29
7.0.140.0060.03918.82
7.0.130.0070.00715.43
7.0.120.0060.00915.24
7.0.110.0030.00715.51
7.0.100.0080.04017.65
7.0.90.0070.04417.59
7.0.80.0080.03817.51
7.0.70.0070.04017.60
7.0.60.0070.04617.68
7.0.50.0090.04217.80
7.0.40.0080.04016.70
7.0.30.0020.05716.76
7.0.20.0000.03716.74
7.0.10.0080.04116.76
7.0.00.0100.04316.54
5.6.400.0030.00714.63
5.6.390.0070.00714.39
5.6.380.0060.01014.16
5.6.370.0120.00414.43
5.6.360.0060.00314.55
5.6.350.0080.00814.31
5.6.340.0040.00714.35
5.6.330.0070.01014.75
5.6.320.0040.00713.98
5.6.310.0060.00614.26
5.6.300.0060.00314.70
5.6.290.0120.00314.18
5.6.280.0030.04317.93
5.6.270.0100.00314.55
5.6.260.0080.00414.15
5.6.250.0070.04317.52
5.6.240.0050.03217.49
5.6.230.0070.04717.54
5.6.220.0050.04417.62
5.6.210.0040.03317.50
5.6.200.0080.02617.63
5.6.190.0050.04717.79
5.6.180.0050.04317.79
5.6.170.0080.04317.68
5.6.160.0070.03717.72
5.6.150.0080.04217.68
5.6.140.0160.03717.78
5.6.130.0100.04417.62
5.6.120.0040.03617.63
5.6.110.0050.04017.74
5.6.100.0060.04417.59
5.6.90.0100.04217.55
5.6.80.0080.03317.37
5.6.70.0030.03817.25
5.6.60.0050.04617.30
5.6.50.0070.04217.36
5.6.40.0050.03017.23
5.6.30.0050.04217.33
5.6.20.0060.02517.34
5.6.10.0100.03017.42
5.6.00.0030.04617.35
5.5.380.0080.04017.30
5.5.370.0070.04217.35
5.5.360.0060.02717.14
5.5.350.0060.04117.36
5.5.340.0100.04217.55
5.5.330.0120.02517.57
5.5.320.0100.03917.62
5.5.310.0050.04217.58
5.5.300.0130.04317.58
5.5.290.0050.03217.40
5.5.280.0070.04217.44
5.5.270.0100.04317.75
5.5.260.0110.03617.50
5.5.250.0030.04617.35
5.5.240.0020.04817.31
5.5.230.0050.02817.04
5.5.220.0060.02317.34
5.5.210.0020.02517.33
5.5.200.0060.04417.20
5.5.190.0030.05017.13
5.5.180.0100.04217.12
5.5.170.0000.01513.89
5.5.160.0030.03017.24
5.5.150.0110.03617.37
5.5.140.0080.04017.22
5.5.130.0050.04217.12
5.5.120.0030.04417.20
5.5.110.0020.04917.22
5.5.100.0050.04317.18
5.5.90.0050.04017.14
5.5.80.0090.04017.28
5.5.70.0100.03817.15
5.5.60.0080.02817.08
5.5.50.0060.04217.14
5.5.40.0090.03917.11
5.5.30.0090.03917.13
5.5.20.0050.04517.10
5.5.10.0050.03517.05
5.5.00.0080.04217.15
5.4.450.0030.04315.96
5.4.440.0080.04015.90
5.4.430.0090.04115.94
5.4.420.0050.04215.89
5.4.410.0050.04215.91
5.4.400.0030.03915.74
5.4.390.0080.04015.64
5.4.380.0050.03015.73
5.4.370.0080.03515.67
5.4.360.0030.04015.78
5.4.350.0090.02215.82
5.4.340.0090.03015.66
5.4.330.0030.01012.43
5.4.320.0080.04115.69
5.4.310.0110.03715.76
5.4.300.0060.03615.78
5.4.290.0050.04315.74
5.4.280.0030.03015.73
5.4.270.0080.04015.75
5.4.260.0070.04215.73
5.4.250.0030.03915.76
5.4.240.0090.03815.73
5.4.230.0110.03515.73
5.4.220.0030.04215.73
5.4.210.0040.04415.80
5.4.200.0050.04015.79
5.4.190.0020.03215.66
5.4.180.0060.04115.81
5.4.170.0070.04315.78
5.4.160.0050.04415.68
5.4.150.0080.03615.73
5.4.140.0110.03214.47
5.4.130.0040.03914.47
5.4.120.0110.03514.41
5.4.110.0050.04214.46
5.4.100.0060.03914.38
5.4.90.0030.02614.49
5.4.80.0080.03314.43
5.4.70.0110.03814.48
5.4.60.0040.03714.45
5.4.50.0080.03814.34
5.4.40.0050.02314.45
5.4.30.0030.02614.39
5.4.20.0050.03314.44
5.4.10.0020.04714.38
5.4.00.0080.02114.17
5.3.290.0000.07714.66
5.3.280.0100.07314.59
5.3.270.0100.06714.72
5.3.260.0130.07014.73
5.3.250.0100.07714.64
5.3.240.0070.07714.64
5.3.230.0030.07714.59
5.3.220.0070.07314.51
5.3.210.0130.06014.59
5.3.200.0070.07014.56
5.3.190.0070.07314.53
5.3.180.0070.07314.56
5.3.170.0070.07314.60
5.3.160.0030.06014.64
5.3.150.0170.06314.64
5.3.140.0030.07714.57
5.3.130.0030.07314.50
5.3.120.0070.07314.58
5.3.110.0100.04714.58
5.3.100.0130.03713.97
5.3.90.0000.04014.14
5.3.80.0030.07714.07
5.3.70.0070.06313.96
5.3.60.0070.05714.07
5.3.50.0070.07314.03
5.3.40.0070.06713.98
5.3.30.0000.07014.06
5.3.20.0030.06313.77
5.3.10.0070.07013.73
5.3.00.0100.06713.71
5.2.170.0030.05011.28
5.2.160.0000.06011.03
5.2.150.0000.07011.07
5.2.140.0070.05711.30
5.2.130.0030.06011.26
5.2.120.0100.05011.03
5.2.110.0000.05311.10
5.2.100.0100.06011.17
5.2.90.0030.05711.14
5.2.80.0070.04311.23
5.2.70.0030.06311.20
5.2.60.0030.06311.16
5.2.50.0070.05311.10
5.2.40.0130.04011.15
5.2.30.0100.05011.08
5.2.20.0070.05710.93
5.2.10.0130.05311.02
5.2.00.0100.05310.86
5.1.60.0000.03710.11
5.1.50.0070.05310.11
5.1.40.0100.05010.11
5.1.30.0000.06010.30
5.1.20.0030.03310.24
5.1.10.0070.05010.18
5.1.00.0000.05710.17
5.0.50.0000.0339.04
5.0.40.0070.0409.04
5.0.30.0000.0539.04
5.0.20.0000.0439.04
5.0.10.0000.0409.04
5.0.00.0000.0439.04
4.4.90.0000.0379.04
4.4.80.0000.0409.04
4.4.70.0030.0309.04
4.4.60.0000.0339.04
4.4.50.0070.0239.04
4.4.40.0070.0479.04
4.4.30.0000.0379.04
4.4.20.0000.0179.04
4.4.10.0030.0339.04
4.4.00.0030.0509.04
4.3.110.0030.0339.04
4.3.100.0070.0239.04
4.3.90.0030.0339.04
4.3.80.0030.0509.04
4.3.70.0030.0309.04
4.3.60.0000.0339.04
4.3.50.0000.0409.04
4.3.40.0070.0509.04
4.3.30.0000.0309.04
4.3.20.0000.0339.04
4.3.10.0000.0209.04
4.3.00.0000.0239.04

preferences:
43.67 ms | 401 KiB | 5 Q