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)
5.6.150.0000.04018.19
5.6.140.0170.07318.27
5.6.130.0030.04018.16
5.6.120.0100.08321.04
5.6.110.0100.08321.02
5.6.100.0170.06021.11
5.6.90.0000.04721.02
5.6.80.0100.07320.38
5.5.300.0100.08018.06
5.5.290.0070.08717.98
5.5.280.0200.08320.95
5.5.270.0130.05020.96
5.5.260.0230.06020.68
5.5.250.0030.08020.62
5.5.240.0170.03320.16
5.4.450.0630.05319.31
5.4.440.0470.06319.36
5.4.430.0500.05719.19
5.4.420.0500.05319.52
5.4.410.0530.05319.39
5.4.400.0500.05718.82
5.4.390.0530.06319.04
5.4.380.0570.05019.21
5.4.370.0730.04719.21
5.4.360.0600.05019.19
5.4.350.0470.05719.23
5.4.340.0530.06019.03
5.4.320.0500.05319.03
5.4.310.0670.04718.86
5.4.300.0470.05719.22
5.4.290.0600.06018.88
5.4.280.0400.06319.30
5.4.270.0470.06319.03
5.4.260.0730.07319.18
5.4.250.0570.04719.02
5.4.240.0630.06019.30
5.4.230.0630.05318.86
5.4.220.0600.05718.80
5.4.210.0900.06319.02
5.4.200.0400.06019.08
5.4.190.0570.05719.22
5.4.180.0470.05719.01
5.4.170.0600.04018.97
5.4.160.0500.05319.03
5.4.150.0670.05318.85
5.4.140.0730.04716.30
5.4.130.0500.05016.41
5.4.120.0600.05716.32
5.4.110.0470.05316.55
5.4.100.0570.04716.56
5.4.90.0530.05016.55
5.4.80.0570.04316.55
5.4.70.0630.04016.53
5.4.60.0600.05716.46
5.4.50.0730.05316.52
5.4.40.0500.05016.32
5.4.30.0570.05316.42
5.4.20.0630.05316.53
5.4.10.0470.05716.52
5.4.00.0670.05015.86

preferences:
143.66 ms | 1394 KiB | 7 Q