3v4l.org

run code in 300+ PHP versions simultaneously
<!DOCTYPE html PUBLIC " - //W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1 - strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Fibonacci sequence</title> <link rel="stylesheet" type="text/css" href="common.css" /> <style type="text/css"> th { text-align: left; background-color: #999; } th, td { padding: 0.4em; } tr.alt td { background: #ddd; } </style> </head> <body> <h2>Fibonacci sequence using recursion</h2> <table cellspacing="0" border="0" style="width: 20em; border: 1px solid #666;"> <tr> <th>Sequence #</th> <th>Value</th> </tr> <?php $iterations = 10;function fibonacci( $n ) { if ( ( $n == 0 ) || ( $n == 1 ) ) return $n; return fibonacci( $n-2 ) + fibonacci( $n-1 ); } for ( $i=0; $i <= $iterations; $i++ ) { ?> <tr<?php if ( $i % 2 != 0 ) echo ' class="alt"' ?>> <td>F<sub><?php echo $i?></sub></td> <td><?php echo fibonacci( $i )?></td> </tr> <?php } ?> </table> </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.70.0110.00716.37
8.3.60.0120.00316.38
8.3.50.0050.01116.55
8.3.40.0140.00718.81
8.3.30.0040.01418.49
8.3.20.0040.00418.48
8.3.10.0080.00018.73
8.3.00.0080.00019.26
8.2.180.0050.01016.63
8.2.170.0070.00722.96
8.2.160.0030.01221.11
8.2.150.0050.00324.18
8.2.140.0030.00624.66
8.2.130.0000.00926.16
8.2.120.0050.00320.88
8.2.110.0070.00320.97
8.2.100.0040.00817.84
8.2.90.0070.00319.42
8.2.80.0070.00019.32
8.2.70.0040.00417.50
8.2.60.0000.00818.04
8.2.50.0040.00418.07
8.2.40.0050.00318.16
8.2.30.0070.00318.04
8.2.20.0090.00017.58
8.2.10.0000.00717.75
8.2.00.0040.00417.59
8.1.280.0150.00025.92
8.1.270.0040.00424.66
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0060.00322.46
8.1.230.0040.00720.95
8.1.220.0050.00317.74
8.1.210.0060.00318.89
8.1.200.0030.00617.35
8.1.190.0040.00417.40
8.1.180.0050.00318.10
8.1.170.0040.00418.80
8.1.160.0040.00418.99
8.1.150.0000.00818.55
8.1.140.0000.00717.51
8.1.130.0000.00717.83
8.1.120.0040.00417.41
8.1.110.0070.00017.36
8.1.100.0020.00517.48
8.1.90.0030.00617.38
8.1.80.0050.00217.36
8.1.70.0050.00317.46
8.1.60.0000.00817.59
8.1.50.0090.00017.37
8.1.40.0050.00317.56
8.1.30.0030.00517.60
8.1.20.0040.00417.49
8.1.10.0030.00617.53
8.1.00.0030.00517.49
8.0.300.0040.00419.90
8.0.290.0050.00216.63
8.0.280.0030.00318.42
8.0.270.0000.00717.21
8.0.260.0030.00316.81
8.0.250.0000.00816.86
8.0.240.0000.00716.92
8.0.230.0030.00316.96
8.0.220.0030.00316.92
8.0.210.0000.00816.91
8.0.200.0030.00316.91
8.0.190.0000.00717.00
8.0.180.0000.00816.89
8.0.170.0030.00616.77
8.0.160.0080.00016.95
8.0.150.0090.00016.86
8.0.140.0060.00316.87
8.0.130.0030.00313.25
8.0.120.0040.00416.86
8.0.110.0040.00416.95
8.0.100.0000.00716.96
8.0.90.0040.00416.86
8.0.80.0100.00616.89
8.0.70.0000.00716.77
8.0.60.0040.00416.77
8.0.50.0040.00416.89
8.0.30.0060.01817.01
8.0.20.0130.01117.16
8.0.10.0040.00417.09
8.0.00.0110.00816.91
7.4.330.0020.00212.99
7.4.320.0040.00416.59
7.4.300.0000.00616.52
7.4.290.0070.00316.60
7.4.280.0030.00516.61
7.4.270.0070.00016.48
7.4.260.0030.00313.29
7.4.250.0090.00016.42
7.4.240.0040.00416.56
7.4.230.0030.00616.40
7.4.220.0090.00916.50
7.4.210.0080.00816.57
7.4.200.0000.00716.63
7.4.190.0070.00016.55
7.4.160.0100.00516.74
7.4.150.0150.00316.71
7.4.140.0160.00616.58
7.4.130.0100.00716.55
7.4.120.0100.00716.35
7.4.110.0140.00616.54
7.4.100.0060.01216.45
7.4.90.0120.01216.52
7.4.80.0130.00919.39
7.4.70.0200.00416.43
7.4.60.0080.00816.46
7.4.50.0000.00916.27
7.4.40.0130.00316.43
7.4.30.0100.00716.39
7.4.00.0060.00614.83
7.3.330.0070.00013.27
7.3.320.0030.00313.15
7.3.310.0070.00016.16
7.3.300.0070.00016.35
7.3.290.0110.00316.25
7.3.280.0050.01016.28
7.3.270.0120.01316.39
7.3.260.0100.00716.71
7.3.250.0130.00616.55
7.3.240.0100.01016.67
7.3.230.0130.00416.48
7.3.210.0040.01416.27
7.3.200.0130.01016.42
7.3.190.0060.01216.31
7.3.180.0130.00616.39
7.3.170.0100.00716.64
7.3.160.0090.00916.34
7.3.120.0100.00514.78
7.3.110.0090.00714.80
7.3.100.0050.00915.00
7.3.90.0060.00514.67
7.3.80.0090.00714.77
7.3.70.0030.01114.78
7.3.60.0000.01314.84
7.3.50.0030.01214.91
7.3.40.0080.00514.88
7.3.30.0050.01014.78
7.3.20.0050.00716.58
7.3.10.0050.00916.56
7.3.00.0070.00716.59
7.2.330.0110.01516.76
7.2.320.0150.00316.80
7.2.310.0040.01616.48
7.2.300.0060.01216.83
7.2.290.0070.01116.59
7.2.240.0110.00815.11
7.2.230.0090.00715.06
7.2.220.0080.00915.25
7.2.210.0060.00614.71
7.2.200.0030.01014.80
7.2.190.0070.00814.98
7.2.180.0040.01214.97
7.2.170.0070.00815.10
7.2.160.0050.00915.20
7.2.150.0020.01217.07
7.2.140.0080.00817.09
7.2.130.0050.00716.85
7.2.120.0040.01016.91
7.2.110.0050.00816.92
7.2.100.0060.00816.89
7.2.90.0070.00617.03
7.2.80.0030.01116.98
7.2.70.0070.00716.84
7.2.60.0070.00816.94
7.2.50.0060.00916.84
7.2.40.0030.00916.96
7.2.30.0050.00816.93
7.2.20.0070.00816.98
7.2.10.0060.00916.88
7.2.00.0080.00517.42
7.1.330.0050.01215.73
7.1.320.0050.01215.75
7.1.310.0070.00615.96
7.1.300.0040.00615.62
7.1.290.0070.00715.76
7.1.280.0130.00215.81
7.1.270.0050.00915.66
7.1.260.0100.00415.85
7.1.250.0050.00815.77
7.1.200.0090.00015.55
7.1.100.0240.01216.42
7.1.70.0000.00817.21
7.1.60.0030.01719.40
7.1.50.0030.01016.70
7.1.00.0030.06322.37
7.0.200.0170.00314.92
7.0.140.0000.07721.95
7.0.120.0030.07721.96
7.0.60.0100.08020.02
7.0.50.0100.03717.80
7.0.40.0070.07717.87
7.0.30.0130.06317.81
7.0.20.0130.07717.72
7.0.10.0070.08017.85
7.0.00.0000.08017.83
5.6.280.0030.07321.04
5.6.210.0070.08320.52
5.6.200.0130.03718.14
5.6.190.0070.08018.16
5.6.180.0070.04718.25
5.6.170.0070.08018.12
5.6.160.0100.03718.25
5.6.150.0100.08318.19
5.6.140.0070.07718.15
5.6.130.0170.06018.27
5.6.120.0030.04318.14
5.6.110.0030.05318.18
5.6.100.0070.08018.13
5.6.90.0130.07718.17
5.6.80.0070.05717.56
5.6.70.0100.07317.65
5.6.60.0100.07317.52
5.6.50.0130.06017.61
5.6.40.0100.05317.51
5.6.30.0030.05317.50
5.6.20.0070.06317.53
5.6.10.0070.06317.51
5.6.00.0030.07717.46
5.5.350.0200.08020.35
5.5.340.0130.05017.96
5.5.330.0130.07017.99
5.5.320.0100.05318.02
5.5.310.0030.05718.02
5.5.300.0070.08018.08
5.5.290.0100.04717.98
5.5.280.0030.06317.98
5.5.270.0100.07318.08
5.5.260.0070.04717.92
5.5.250.0070.05317.87
5.5.240.0070.07717.33
5.5.230.0070.04317.40
5.5.220.0030.08017.33
5.5.210.0070.04717.43
5.5.200.0070.08017.33
5.5.190.0070.07717.28
5.5.180.0030.06717.37
5.5.160.0000.08017.32
5.5.150.0070.07317.27
5.5.140.0070.07017.34
5.5.130.0130.05017.45
5.5.120.0100.08317.36
5.5.110.0030.04317.42
5.5.100.0100.07317.24
5.5.90.0130.07017.26
5.5.80.0030.07017.34
5.5.70.0070.07317.16
5.5.60.0030.07317.34
5.5.50.0170.06717.32
5.5.40.0030.07717.22
5.5.30.0100.07317.23
5.5.20.0130.07317.32
5.5.10.0030.06717.20
5.5.00.0170.06717.25
5.4.450.0100.08019.37
5.4.440.0070.04019.35
5.4.430.0100.04319.30
5.4.420.0070.08319.33
5.4.410.0100.07719.32
5.4.400.0000.08019.05
5.4.390.0070.07718.95
5.4.380.0070.06719.27
5.4.370.0030.06319.14
5.4.360.0100.07719.10
5.4.350.0070.03719.12
5.4.340.0030.05319.09
5.4.320.0030.06019.12
5.4.310.0030.06719.12
5.4.300.0030.08018.98
5.4.290.0130.07319.05
5.4.280.0030.08018.99
5.4.270.0100.03719.02
5.4.260.0000.06719.03
5.4.250.0070.07319.30
5.4.240.0100.07019.11
5.4.230.0170.07019.26
5.4.220.0200.03719.00
5.4.210.0000.08018.88
5.4.200.0070.07319.13
5.4.190.0070.07319.09
5.4.180.0030.08019.11
5.4.170.0070.07719.04
5.4.160.0100.07019.03
5.4.150.0170.05019.02
5.4.140.0030.06016.30
5.4.130.0070.04016.33
5.4.120.0030.04716.40
5.4.110.0000.07716.56
5.4.100.0170.06316.48
5.4.90.0100.06016.41
5.4.80.0070.06316.32
5.4.70.0030.07316.28
5.4.60.0070.04016.32
5.4.50.0000.08016.36
5.4.40.0000.06316.41
5.4.30.0130.06016.61
5.4.20.0070.05016.38
5.4.10.0200.06716.42
5.4.00.0070.07015.87
5.3.290.0070.05714.52
5.3.280.0100.06014.56
5.3.270.0030.07714.46
5.3.260.0100.07314.63
5.3.250.0000.07014.64
5.3.240.0030.08014.67
5.3.230.0030.07714.63
5.3.220.0130.06714.79
5.3.210.0100.03714.59
5.3.200.0070.03314.42
5.3.190.0030.07714.53
5.3.180.0070.07714.62
5.3.170.0070.07014.59
5.3.160.0100.04314.78
5.3.150.0000.04714.63
5.3.140.0100.07014.57
5.3.130.0030.05314.55
5.3.120.0100.05014.62
5.3.110.0170.07314.60
5.3.100.0100.04014.03
5.3.90.0030.04314.05
5.3.80.0070.03714.07
5.3.70.0000.04714.05
5.3.60.0100.04714.00
5.3.50.0230.05714.04
5.3.40.0000.07713.97
5.3.30.0130.05313.94
5.3.20.0000.08013.59
5.3.10.0070.06713.63
5.3.00.0000.03713.66
5.2.170.0070.06010.99
5.2.160.0070.06011.14
5.2.150.0000.06311.16
5.2.140.0030.04011.36
5.2.130.0100.06011.31
5.2.120.0100.05711.09
5.2.110.0070.04011.32
5.2.100.0130.04010.96
5.2.90.0070.03711.17
5.2.80.0100.03311.19
5.2.70.0070.03010.99
5.2.60.0070.02711.09
5.2.50.0070.05710.87
5.2.40.0130.04711.00
5.2.30.0030.05710.99
5.2.20.0100.05310.98
5.2.10.0170.02710.95
5.2.00.0070.05710.79
5.1.60.0030.03010.02
5.1.50.0070.0309.91
5.1.40.0070.0279.81
5.1.30.0070.03010.29
5.1.20.0030.05710.34
5.1.10.0030.03710.10
5.1.00.0100.05010.14
5.0.50.0030.0378.59
5.0.40.0070.0408.45
5.0.30.0030.0578.32
5.0.20.0030.0208.24
5.0.10.0070.0208.26
5.0.00.0070.0538.07
4.4.90.0030.0177.84
4.4.80.0070.0307.84
4.4.70.0030.0307.84
4.4.60.0000.0207.84
4.4.50.0030.0337.84
4.4.40.0000.0507.84
4.4.30.0030.0137.84
4.4.20.0000.0277.84
4.4.10.0030.0377.84
4.4.00.0000.0337.84
4.3.110.0000.0377.84
4.3.100.0030.0377.84
4.3.90.0030.0177.84
4.3.80.0030.0307.84
4.3.70.0070.0307.84
4.3.60.0030.0337.84
4.3.50.0000.0277.84
4.3.40.0030.0537.84
4.3.30.0000.0307.84
4.3.20.0000.0237.84
4.3.10.0000.0207.84
4.3.00.0000.0407.84

preferences:
49.28 ms | 401 KiB | 5 Q