3v4l.org

run code in 300+ PHP versions simultaneously
<?php function fetch_fb_fans($fanpage_name, $no_of_retries = 10, $pause = 500000 /* 500ms */){ $ret = array(); // get page info from graph $fanpage_data = json_decode(file_get_contents('http://facebook.com/' . $fanpage_name), true); if(empty($fanpage_data['id'])){ // invalid fanpage name return $ret; } $matches = array(); $url = 'http://www.facebook.com/plugins/fan.php?connections=100&id=' . $fanpage_data['id']; $context = stream_context_create(array('http' => array('header' => 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:22.0) Gecko/20100101 Firefox/22.0'))); for($a = 0; $a < $no_of_retries; $a++){ $like_html = file_get_contents($url, false, $context); preg_match_all('{href="https?://www\.facebook\.com/([a-zA-Z0-9._-]+)" data-jsid="anchor" target="_blank"}', $like_html, $matches); if(empty($matches[1])){ // failed to fetch any fans - convert returning array, cause it might be not empty return array_keys($ret); }else{ // merge profiles as array keys so they will stay unique $ret = array_merge($ret, array_flip($matches[1])); } // don't get banned as flooder usleep($pause); } return array_keys($ret); } print_r(fetch_fb_fans('ivcrn', 2, 400000)); // prints 73 unique fan names as array

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.0100.01018.64
8.3.60.0120.00617.13
8.3.50.0280.00922.15
8.3.40.0040.01219.09
8.3.30.0060.01119.00
8.3.20.0070.00020.54
8.3.10.0070.00423.95
8.3.00.0000.00919.63
8.2.180.0030.01417.13
8.2.170.0140.00722.96
8.2.160.0090.00620.47
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0030.00526.16
8.2.120.0070.00317.88
8.2.110.0000.01222.52
8.2.100.0060.00618.30
8.2.90.0040.00419.30
8.2.80.0000.00917.97
8.2.70.0060.00317.75
8.2.60.0030.00618.28
8.2.50.0000.00818.07
8.2.40.0000.00819.59
8.2.30.0080.00020.77
8.2.20.0060.00317.94
8.2.10.0000.00818.39
8.2.00.0000.00818.17
8.1.280.0140.00425.92
8.1.270.0040.00424.09
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0060.00322.77
8.1.230.0090.00318.01
8.1.220.0030.00517.91
8.1.210.0000.00818.77
8.1.200.0000.01017.48
8.1.190.0080.00017.48
8.1.180.0030.00518.10
8.1.170.0000.00719.14
8.1.160.0000.00722.12
8.1.150.0000.00718.93
8.1.140.0040.00419.80
8.1.130.0050.00217.83
8.1.120.0040.00417.57
8.1.110.0000.00817.44
8.1.100.0040.00417.48
8.1.90.0060.00317.53
8.1.80.0040.00417.54
8.1.70.0030.00317.55
8.1.60.0000.00817.68
8.1.50.0040.00417.79
8.1.40.0000.00817.67
8.1.30.0050.00317.84
8.1.20.0000.00917.83
8.1.10.0040.00417.73
8.1.00.0030.00517.67
8.0.300.0040.00418.77
8.0.290.0000.00717.00
8.0.280.0040.00418.73
8.0.270.0030.00317.46
8.0.260.0060.00317.50
8.0.250.0000.00817.31
8.0.240.0040.00417.19
8.0.230.0030.00317.24
8.0.220.0040.00417.22
8.0.210.0040.00417.26
8.0.200.0030.00317.36
8.0.190.0080.00017.22
8.0.180.0040.00417.20
8.0.170.0080.00017.21
8.0.160.0000.00717.31
8.0.150.0060.00317.08
8.0.140.0030.00517.10
8.0.130.0030.00313.59
8.0.120.0030.00617.13
8.0.110.0070.00017.23
8.0.100.0040.00417.17
8.0.90.0040.00417.13
8.0.80.0160.00317.18
8.0.70.0040.00417.08
8.0.60.0040.00417.20
8.0.50.0040.00417.09
8.0.30.0100.01017.32
8.0.20.0100.01217.54
8.0.10.0040.00417.26
8.0.00.0130.00816.92
7.4.330.0030.00315.39
7.4.320.0000.00716.62
7.4.300.0060.00016.66
7.4.290.0030.00316.80
7.4.280.0080.00416.64
7.4.270.0030.00316.73
7.4.260.0070.00316.85
7.4.250.0030.00516.75
7.4.240.0030.00416.73
7.4.230.0030.00516.66
7.4.220.0190.00316.71
7.4.210.0120.00616.86
7.4.200.0050.00216.85
7.4.160.0110.00716.89
7.4.150.0110.00717.40
7.4.140.0180.00617.86
7.4.130.0070.01216.79
7.4.120.0130.00616.89
7.4.110.0070.01616.98
7.4.100.0110.01216.87
7.4.90.0100.01316.75
7.4.80.0130.00719.39
7.4.70.0060.01116.83
7.4.60.0100.00716.73
7.4.50.0040.00416.86
7.4.40.0070.01116.91
7.4.30.0120.01216.76
7.4.00.0020.01615.17
7.3.330.0000.00613.57
7.3.320.0060.00013.63
7.3.310.0000.00716.56
7.3.300.0000.00716.60
7.3.290.0100.00916.69
7.3.280.0110.01016.67
7.3.270.0180.00617.40
7.3.260.0100.01016.69
7.3.240.0110.01316.64
7.3.230.0120.00616.52
7.3.210.0060.01216.73
7.3.200.0100.00716.82
7.3.190.0120.00616.59
7.3.180.0140.01016.58
7.3.170.0110.00516.63
7.3.160.0140.00616.80
7.3.120.0100.01015.11
7.3.110.0030.00915.23
7.3.100.0130.00315.08
7.3.90.0110.00015.23
7.3.80.0030.00615.25
7.3.70.0110.00714.83
7.3.60.0060.00715.10
7.3.50.0030.01015.29
7.3.40.0000.01514.83
7.3.30.0040.00815.24
7.3.20.0060.00916.99
7.3.10.0090.00416.87
7.3.00.0060.00816.87
7.2.330.0100.01016.77
7.2.320.0120.01216.88
7.2.310.0070.01016.85
7.2.300.0030.01516.68
7.2.290.0060.01216.95
7.2.250.0060.01215.27
7.2.240.0070.01015.48
7.2.230.0030.01415.25
7.2.220.0030.01315.54
7.2.210.0030.00915.29
7.2.200.0110.00715.36
7.2.190.0030.01015.25
7.2.180.0000.01415.16
7.2.170.0070.01114.95
7.2.130.0040.01217.14
7.2.120.0000.01416.65
7.2.110.0100.00016.96
7.2.100.0030.01317.03
7.2.90.0030.01217.30
7.2.80.0000.01317.07
7.2.70.0040.00717.11
7.2.60.0070.00717.12
7.2.50.0060.00917.29
7.2.40.0090.00317.28
7.2.30.0060.00617.04
7.2.20.0060.00916.93
7.2.10.0130.00317.00
7.2.00.0060.00718.40
7.1.330.0120.00615.83
7.1.320.0090.00615.80
7.1.310.0030.01315.69
7.1.300.0030.01015.73
7.1.290.0080.00816.11
7.1.280.0040.01116.09
7.1.270.0040.01116.02
7.1.260.0100.00316.05
7.1.250.0040.01115.85
7.1.200.0060.00916.04
7.1.100.0060.00918.05
7.1.70.0000.00717.50
7.1.60.0130.01319.43
7.1.50.0170.00717.29
7.1.00.0070.07322.64
7.0.200.0330.00315.10
7.0.60.0030.08020.36
7.0.50.0070.04318.22
7.0.40.0070.07720.53
7.0.30.0000.09320.48
7.0.20.0600.05720.61
7.0.10.0100.06020.44
7.0.00.0070.07720.48
5.6.280.0000.06321.48
5.6.210.0030.05720.94
5.6.200.0130.04718.50
5.6.190.0200.04321.05
5.6.180.0500.06721.13
5.6.170.0270.05320.86
5.6.160.0100.08320.81
5.6.150.0100.07718.56
5.6.140.0070.04318.46
5.6.130.0070.05018.41
5.6.120.0100.03721.25
5.6.110.0030.04321.43
5.6.100.0070.05021.38
5.6.90.0070.03721.32
5.6.80.0030.07720.91
5.5.350.0400.07020.77
5.5.340.0100.03318.38
5.5.330.0030.08720.77
5.5.320.0130.04720.61
5.5.310.0300.07320.68
5.5.300.0130.07018.20
5.5.290.0070.04718.22
5.5.280.0030.04321.01
5.5.270.0000.04721.09
5.5.260.0030.08721.29
5.5.250.0070.08321.10
5.5.240.0070.08020.64
5.4.450.0170.08019.90
5.4.440.0230.05320.09
5.4.430.0300.07020.04
5.4.420.0170.07319.97
5.4.410.0200.08019.88
5.4.400.0270.04719.85
5.4.390.0270.04319.73
5.4.380.0200.05019.60
5.4.370.0130.06319.61
5.4.360.0230.07019.73
5.4.350.0200.07019.65
5.4.340.0370.05719.84
5.4.320.0100.08719.69
5.4.310.0300.06719.61
5.4.300.0170.04719.67
5.4.290.0270.07019.65
5.4.280.0170.05319.68
5.4.270.0170.05019.61
5.4.260.0230.03719.68
5.4.250.0170.03719.68
5.4.240.0270.06719.68
5.4.230.0270.04719.73
5.4.220.0200.06719.76
5.4.210.0270.06719.63
5.4.200.0300.06319.83
5.4.190.0230.04319.56
5.4.180.0200.07319.71
5.4.170.0270.03319.63
5.4.160.0270.05019.72
5.4.150.0200.07719.63
5.4.140.0170.07317.01
5.4.130.0230.06317.09
5.4.120.0230.06717.00
5.4.110.0230.05717.20
5.4.100.0230.06316.97
5.4.90.0300.07017.20

preferences:
56.54 ms | 401 KiB | 5 Q