3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getTopNews($number = 5,$reset =false) { static $cache = false; //cache reset if ($reset) $cache = false; //cache get if ($cache){ echo 'cache '; return $cache; } else { echo 'query '; /*$res = db_query("SELECT id,header,content FROM `news` ORDER BY id DESC LIMIT %d",(int)$number); while($row = db_fetch_array($res)){ $out[] = $row; } */ $out ='db'+rand(1,111); //cache set $cache = $out; } return $out; } echo getTopNews(); echo '<br />'; echo getTopNews();

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.2.120.0060.00916.69
7.2.110.0060.00316.71
7.2.100.0000.01616.49
7.2.90.0100.00616.67
7.2.80.0060.00616.42
7.2.70.0070.00317.02
7.2.60.0090.00616.55
7.2.50.0060.00316.70
7.2.40.0040.01116.91
7.2.30.0080.00316.82
7.2.20.0080.00617.05
7.2.10.0030.00917.05
7.2.00.0030.01016.72
7.1.240.0090.00615.61
7.1.230.0130.00015.75
7.1.220.0090.00615.75
7.1.210.0000.01415.71
7.1.200.0100.00315.63
7.1.190.0060.00915.82
7.1.180.0130.00315.60
7.1.170.0120.00615.89
7.1.160.0050.00315.89
7.1.150.0100.00315.64
7.1.140.0060.00615.84
7.1.130.0140.00015.61
7.1.120.0060.00915.85
7.1.110.0060.00915.82
7.1.100.0070.00315.91
7.1.90.0060.00615.65
7.1.80.0060.00615.82
7.1.70.0070.00416.51
7.1.60.0050.01317.53
7.1.50.0050.01316.54
7.1.40.0000.01115.86
7.1.30.0080.00415.67
7.1.20.0000.01415.86
7.1.10.0100.00715.83
7.1.00.0020.04019.11
7.0.320.0030.01015.41
7.0.310.0060.01015.38
7.0.300.0060.01015.16
7.0.290.0070.00715.52
7.0.280.0030.01015.27
7.0.270.0140.00015.38
7.0.260.0030.00715.24
7.0.250.0000.01515.44
7.0.240.0050.00215.46
7.0.230.0070.00715.54
7.0.220.0030.00915.47
7.0.210.0060.00615.20
7.0.200.0100.00915.13
7.0.190.0030.00915.12
7.0.180.0030.01015.33
7.0.170.0040.01115.30
7.0.160.0000.01315.55
7.0.150.0080.00415.40
7.0.140.0080.03718.76
7.0.130.0060.00915.43
7.0.120.0030.01015.44
7.0.110.0070.00715.52
7.0.100.0090.00615.27
7.0.90.0030.01215.36
7.0.80.0090.00315.43
7.0.70.0090.00615.39
7.0.60.0090.03517.65
7.0.50.0030.02816.53
7.0.40.0110.04115.56
7.0.30.0080.02515.64
7.0.20.0120.03815.47
7.0.10.0030.03115.56
7.0.00.0040.03515.66
5.6.380.0070.00714.25
5.6.370.0030.01014.65
5.6.360.0000.01214.11
5.6.350.0080.00414.28
5.6.340.0030.00914.36
5.6.330.0000.00814.65
5.6.320.0100.00714.61
5.6.310.0070.00713.98
5.6.300.0100.00314.23
5.6.290.0060.00614.43
5.6.280.0060.04517.52
5.6.270.0060.00614.74
5.6.260.0040.00414.12
5.6.250.0030.00714.09
5.6.240.0040.00914.39
5.6.230.0100.00314.65
5.6.220.0000.01414.16
5.6.210.0070.04217.49
5.6.200.0070.02316.29
5.6.190.0060.02616.37
5.6.180.0030.02716.14
5.6.170.0070.04316.29
5.6.160.0070.03916.22
5.6.150.0060.03716.31
5.6.140.0030.02816.11
5.6.130.0050.03816.38
5.6.120.0020.05216.25
5.6.110.0090.04216.27
5.6.100.0100.02516.22
5.6.90.0090.04216.18
5.6.80.0070.04315.81
5.6.70.0110.04015.81
5.6.60.0090.04116.09
5.6.50.0070.04216.01
5.6.40.0070.03815.89
5.6.30.0050.04115.83
5.6.20.0100.03815.81
5.6.10.0050.04815.98
5.6.00.0030.02415.91
5.5.380.0090.00311.30
5.5.370.0040.00811.33
5.5.360.0070.00311.46
5.5.350.1970.02115.75
5.5.340.0030.02214.58
5.5.330.0050.04114.73
5.5.320.0020.02614.66
5.5.310.0060.04114.56
5.5.300.0050.04714.66
5.5.290.0070.04214.65
5.5.280.0020.03814.58
5.5.270.0050.03014.57
5.5.260.0070.04214.52
5.5.250.0090.04014.52
5.5.240.0000.04714.27
5.5.230.0030.04214.32
5.5.220.0120.03514.29
5.5.210.0040.04414.24
5.5.200.0060.03814.26
5.5.190.0030.02814.20
5.5.180.0070.03714.27
5.5.170.0000.00914.05
5.5.160.0080.02714.20
5.5.150.0070.04114.27
5.5.140.0050.04314.25
5.5.130.0030.04314.23
5.5.120.0050.04314.26
5.5.110.0060.03814.25
5.5.100.0070.02714.26
5.5.90.0090.03514.21
5.5.80.0080.04014.13
5.5.70.0030.02214.20
5.5.60.0070.03014.15
5.5.50.0000.02714.17
5.5.40.0110.03514.15
5.5.30.0050.04214.25
5.5.20.0090.04014.21
5.5.10.0070.03014.14
5.5.00.0090.03114.16
5.4.450.0030.04715.29
5.4.440.0080.03815.30
5.4.430.0030.03715.21
5.4.420.0050.04215.20
5.4.410.0110.03515.12
5.4.400.0100.03715.11
5.4.390.0030.04015.08
5.4.380.0090.02315.03
5.4.370.0060.02815.10
5.4.360.0030.04415.05
5.4.350.0070.03815.07
5.4.340.0010.02615.04
5.4.330.0030.00711.07
5.4.320.0080.02715.12
5.4.310.0080.02315.11
5.4.300.0060.02615.10
5.4.290.0050.02215.12
5.4.280.0030.04214.99
5.4.270.0020.04214.98
5.4.260.0070.03815.05
5.4.250.0090.03815.06
5.4.240.0050.02515.10
5.4.230.0020.03415.02
5.4.220.0070.01815.07
5.4.210.0030.02615.04
5.4.200.0020.04115.04
5.4.190.0050.03315.17
5.4.180.0030.03415.04
5.4.170.0070.02315.11
5.4.160.0090.02814.97
5.4.150.0120.02815.04
5.4.140.0050.02413.86
5.4.130.0050.02013.71
5.4.120.0060.02013.75
5.4.110.0080.01813.69
5.4.100.0060.02313.76
5.4.90.0070.03813.75
5.4.80.0110.03513.72
5.4.70.0060.03713.79
5.4.60.0070.03713.87
5.4.50.0040.03313.70
5.4.40.0020.02813.72
5.4.30.0070.03613.81
5.4.20.0020.02513.71
5.4.10.0100.03713.73
5.4.00.0030.03813.40
5.3.290.0060.03412.90
5.3.280.0070.02012.86
5.3.270.0050.03212.87
5.3.260.0060.01812.87
5.3.250.0010.03012.87
5.3.240.0050.02212.94
5.3.230.0050.02012.83
5.3.220.0020.02112.80
5.3.210.0120.02312.85
5.3.200.0030.02712.81
5.3.190.0030.02712.79
5.3.180.0090.01812.82
5.3.170.0090.03512.82
5.3.160.0040.04312.83
5.3.150.0070.03512.84
5.3.140.0050.04012.83
5.3.130.0030.04112.86
5.3.120.0070.03012.83
5.3.110.0020.02412.83
5.3.100.0020.02212.56
5.3.90.0090.03112.52
5.3.80.0070.02212.55
5.3.70.0030.02912.59
5.3.60.0030.04012.53
5.3.50.0080.03812.53
5.3.40.0050.02012.52
5.3.30.0050.02512.49
5.3.20.0040.01912.36
5.3.10.0000.04512.39
5.3.00.0050.03912.45
5.2.170.0060.03511.06
5.2.160.0050.01811.14
5.2.150.0030.01811.04
5.2.140.0030.01611.13
5.2.130.0040.03211.14
5.2.120.0070.03311.09
5.2.110.0030.03511.12
5.2.100.0030.02711.10
5.2.90.0050.02511.07
5.2.80.0000.02111.11
5.2.70.0030.01811.11
5.2.60.0020.02211.05
5.2.50.0090.02811.02
5.2.40.0060.03210.98
5.2.30.0050.02911.04
5.2.20.0100.02711.04
5.2.10.0030.03610.96
5.2.00.0060.02110.87
5.1.60.0020.03110.58
5.1.50.0070.01410.64
5.1.40.0020.02410.44
5.1.30.0030.01610.70
5.1.20.0020.01610.71
5.1.10.0040.01210.56
5.1.00.0020.01510.59
5.0.50.0020.0139.86
5.0.40.0000.0159.72
5.0.30.0040.0159.72
5.0.20.0000.0139.72
5.0.10.0000.0139.72
5.0.00.0050.0159.72
4.4.90.0020.0109.72
4.4.80.0020.0209.72
4.4.70.0020.0209.72
4.4.60.0000.0239.72
4.4.50.0020.0159.72
4.4.40.0000.0299.72
4.4.30.0020.0109.72
4.4.20.0020.0109.72
4.4.10.0030.0099.72
4.4.00.0030.0139.72
4.3.110.0020.0109.72
4.3.100.0020.0109.72
4.3.90.0000.0099.72
4.3.80.0050.0149.72
4.3.70.0020.0089.72
4.3.60.0000.0099.72
4.3.50.0020.0159.72
4.3.40.0030.0129.72
4.3.30.0020.0089.72
4.3.20.0000.0129.72
4.3.10.0030.0109.72
4.3.00.0000.0099.72

preferences:
36.74 ms | 401 KiB | 5 Q