3v4l.org

run code in 300+ PHP versions simultaneously
<?php //Pi calculation code //From Chao Xu //At http://www.webdevlogs.com function bcpi($precision){ $num = "0";$k = "0"; bcscale(bcadd($precision,3)); $limit = ($precision+3)/14; while($k < $limit){ $num = bcadd($num,bcdiv(bcmul(bcadd('13591409',bcmul('545140134', $k)),bcmul(bcpow(-1, $k), bcfact(6*$k))),bcmul(bcmul(bcpow('640320',3*$k+1),bcsqrt('640320')), bcmul(bcfact(3*$k), bcpow(bcfact($k),3))))); ++$k; } return bcdiv(1,(bcmul(12,($num))),$precision); } function bcfact($n){ return ($n == 0 || $n== 1) ? 1 : bcmul($n,bcfact($n-1)); } echo bcpi(15);

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.0140.00316.75
8.3.50.0080.01021.90
8.3.40.0070.00718.84
8.3.30.0060.01019.09
8.3.20.0050.00320.39
8.3.10.0050.00323.70
8.3.00.0060.00319.25
8.2.180.0150.00318.41
8.2.170.0080.00822.96
8.2.160.0100.00320.32
8.2.150.0000.00824.18
8.2.140.0030.00524.66
8.2.130.0080.00026.16
8.2.120.0040.00422.25
8.2.110.0030.00721.03
8.2.100.0080.00417.91
8.2.90.0050.00319.09
8.2.80.0050.00317.97
8.2.70.0080.00017.35
8.2.60.0040.00417.80
8.2.50.0080.00018.07
8.2.40.0000.00818.03
8.2.30.0040.00418.14
8.2.20.0000.00817.66
8.2.10.0000.00718.19
8.2.00.0070.00317.81
8.1.280.0100.00725.92
8.1.270.0080.00023.96
8.1.260.0030.00626.35
8.1.250.0040.00428.09
8.1.240.0060.00321.44
8.1.230.0030.00917.45
8.1.220.0000.00817.79
8.1.210.0000.00818.77
8.1.200.0030.00617.23
8.1.190.0040.00417.10
8.1.180.0050.00318.10
8.1.170.0030.00518.59
8.1.160.0030.00521.99
8.1.150.0050.00318.65
8.1.140.0000.00817.52
8.1.130.0030.00317.74
8.1.120.0050.00317.48
8.1.110.0000.00817.42
8.1.100.0000.00717.52
8.1.90.0080.00017.43
8.1.80.0030.00517.50
8.1.70.0000.00717.43
8.1.60.0060.00317.64
8.1.50.0000.00817.45
8.1.40.0000.00817.52
8.1.30.0030.00617.64
8.1.20.0000.00717.68
8.1.10.0000.00817.37
8.1.00.0000.00717.52
8.0.300.0030.00718.77
8.0.290.0040.00416.75
8.0.280.0000.00718.32
8.0.270.0070.00017.18
8.0.260.0000.00817.20
8.0.250.0030.00316.87
8.0.240.0060.00316.93
8.0.230.0000.00716.96
8.0.220.0030.00316.89
8.0.210.0070.00016.76
8.0.200.0030.00316.95
8.0.190.0030.00616.87
8.0.180.0000.00716.93
8.0.170.0000.00816.93
8.0.160.0040.00316.91
8.0.150.0050.00316.76
8.0.140.0000.00816.83
8.0.130.0030.00313.43
8.0.120.0000.00816.79
8.0.110.0000.00816.93
8.0.100.0000.00716.83
8.0.90.0050.00316.84
8.0.80.0060.00916.82
8.0.70.0050.00316.84
8.0.60.0000.00816.72
8.0.50.0000.00716.75
8.0.30.0140.00816.98
8.0.20.0130.00817.40
8.0.10.0070.00017.02
8.0.00.0110.01116.85
7.4.330.0050.00015.00
7.4.320.0060.00016.52
7.4.300.0000.00816.63
7.4.290.0000.00816.44
7.4.280.0080.00016.51
7.4.270.0050.00316.65
7.4.260.0030.00316.50
7.4.250.0000.00716.33
7.4.240.0030.00516.57
7.4.230.0000.00716.59
7.4.220.0060.01216.69
7.4.210.0060.00916.63
7.4.200.0000.00716.59
7.4.190.0040.00416.77
7.4.160.0130.00316.54
7.4.150.0100.00717.40
7.4.140.0090.00917.86
7.4.130.0130.00816.43
7.4.120.0090.00916.58
7.4.110.0090.00916.51
7.4.100.0140.00416.54
7.4.90.0090.00816.70
7.4.80.0030.01419.39
7.4.70.0160.00016.51
7.4.60.0090.00616.58
7.4.50.0030.00516.34
7.4.40.0070.01022.77
7.4.30.0110.00616.44
7.4.00.0070.00715.05
7.3.330.0060.00013.19
7.3.320.0000.00513.35
7.3.310.0040.00416.21
7.3.300.0070.00016.18
7.3.290.0150.00616.34
7.3.280.0080.00816.32
7.3.270.0040.01217.40
7.3.260.0090.00916.77
7.3.250.0080.01216.53
7.3.240.0150.00716.43
7.3.230.0120.01216.55
7.3.210.0090.00916.69
7.3.200.0190.00919.39
7.3.190.0160.00016.55
7.3.180.0050.01016.60
7.3.170.0090.00616.52
7.3.160.0100.00716.60
7.3.120.0090.00615.04
7.2.330.0180.00416.87
7.2.320.0060.01616.61
7.2.310.0120.00416.57
7.2.300.0070.01016.80
7.2.290.0110.00516.67
7.2.60.0030.01317.01
7.2.00.0150.00619.40
7.1.200.0040.01115.57
7.1.100.0060.00618.29
7.1.70.0000.01316.87
7.1.60.0040.02119.33
7.1.50.0000.01517.01
7.1.00.0100.07022.36
7.0.200.0510.01014.53
7.0.140.0100.06722.00
7.0.60.0100.08020.05
7.0.50.0000.04717.89
7.0.40.0100.08320.15
7.0.30.0300.08320.07
7.0.20.0230.06020.05
7.0.10.0100.06320.23
7.0.00.0100.08320.14
5.6.280.0030.07320.92
5.6.210.0130.08020.71
5.6.200.0200.05018.29
5.6.190.0030.05320.64
5.6.180.3830.03320.64
5.6.170.0270.05320.56
5.6.160.0100.04020.50
5.6.150.0070.08718.18
5.6.140.0100.08018.23
5.6.130.0030.04718.16
5.6.120.0030.04020.89
5.6.110.0130.03321.05
5.6.100.0100.08021.02
5.6.90.0030.09021.14
5.6.80.0030.04020.30
5.5.350.0170.06020.41
5.5.340.0130.07718.09
5.5.330.0100.07720.57
5.5.320.0430.07320.32
5.5.310.0170.04020.36
5.5.300.0030.08317.98
5.5.290.0100.08017.95
5.5.280.0100.05020.66
5.5.270.0130.04720.93
5.5.260.0030.07020.77
5.5.250.0070.04020.56
5.5.240.0100.09020.05
5.4.450.0770.04019.35
5.4.440.0400.04719.64
5.4.430.1030.05019.46
5.4.420.0900.05019.27
5.4.410.0670.03719.14
5.4.400.1070.02319.25
5.4.390.0330.03318.95
5.4.380.0430.05718.73
5.4.370.0500.04718.74
5.4.360.0630.06718.83
5.4.350.0530.07018.83
5.4.340.0330.06018.58
5.4.320.0070.03512.51
5.4.310.0080.04712.50
5.4.300.0030.04112.52
5.4.290.0080.04212.51
5.4.280.0060.04412.38
5.4.270.0060.04412.38
5.4.260.0080.04112.38
5.4.250.0090.03812.38
5.4.240.0080.03812.38
5.4.230.0080.04412.37
5.4.220.0040.04312.38
5.4.210.0090.04012.38
5.4.200.0120.06112.37
5.4.190.0120.05812.37
5.4.180.0100.05912.37
5.4.170.0200.08812.37
5.4.160.0170.07412.38
5.4.150.0290.08812.36
5.4.140.0140.07212.05
5.4.130.0100.08312.04
5.4.120.0110.09412.00
5.4.110.0110.05411.99
5.4.100.0150.05811.99
5.4.90.0200.08011.99
5.4.80.0110.05311.99
5.4.70.0060.04411.99
5.4.60.0080.04411.99
5.4.50.0140.05011.99
5.4.40.0090.04911.98
5.4.30.0090.04911.97
5.4.20.0210.08611.97
5.4.10.0080.04811.97
5.4.00.0110.03511.46
5.3.290.0070.04012.80
5.3.280.0080.03912.71
5.3.270.0100.05112.73
5.3.260.0100.05912.72
5.3.250.0100.04812.72
5.3.240.0100.07012.72
5.3.230.0130.05312.71
5.3.220.0140.05812.68
5.3.210.0140.06712.68
5.3.200.0120.07512.68
5.3.190.0190.09312.68
5.3.180.0190.07212.68
5.3.170.0200.06112.67
5.3.160.0100.06912.67
5.3.150.0120.05012.67
5.3.140.0180.07112.66
5.3.130.0160.06912.66
5.3.120.0160.09612.66
5.3.110.0100.05812.66
5.3.100.0060.05612.12
5.3.90.0110.05012.09
5.3.80.0150.08612.08
5.3.70.0250.05812.08
5.3.60.0200.05012.06
5.3.50.0100.05712.00
5.3.40.0100.06112.01
5.3.30.0070.05711.96
5.3.20.0160.06611.75
5.3.10.0100.04711.71
5.3.00.0150.06011.71
5.2.170.0070.0449.20
5.2.160.0080.0519.20
5.2.150.0080.0439.20
5.2.140.0070.0419.20
5.2.130.0030.0359.16
5.2.120.0060.0339.16
5.2.110.0060.0439.16
5.2.100.0090.0459.16
5.2.90.0090.0449.16
5.2.80.0090.0529.16
5.2.70.0080.0439.15
5.2.60.0080.0569.11
5.2.50.0070.0429.08
5.2.40.0130.0459.05
5.2.30.0120.0469.03
5.2.20.0240.0869.01
5.2.10.0080.0608.93
5.2.00.0120.0398.80
5.1.60.0100.0368.09
5.1.50.0050.0428.09
5.1.40.0100.0408.06
5.1.30.0110.0428.41
5.1.20.0060.0458.43
5.1.10.0080.0388.16
5.1.00.0080.0388.16
5.0.50.0080.0276.64
5.0.40.0050.0296.50
5.0.30.0040.0456.31
5.0.20.0070.0266.29
5.0.10.0050.0296.27
5.0.00.0060.0416.25
4.4.90.0030.0234.78
4.4.80.0050.0224.75
4.4.70.0060.0214.75
4.4.60.0050.0224.76
4.4.50.0050.0224.77
4.4.40.0090.0304.71
4.4.30.0040.0234.76
4.4.20.0060.0204.84
4.4.10.0030.0254.85
4.4.00.0060.0314.76
4.3.110.0060.0214.66
4.3.100.0050.0224.66
4.3.90.0000.0274.63
4.3.80.0030.0344.59
4.3.70.0050.0204.63
4.3.60.0030.0154.63
4.3.50.0030.0254.63
4.3.40.0060.0334.54
4.3.30.0040.0223.31
4.3.20.0020.0243.31
4.3.10.0040.0223.26
4.3.00.0100.01713.47

preferences:
40.29 ms | 401 KiB | 5 Q