3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace ProxyChecker; class ProxyChecker { private $proxyCheckUrl; private $config = array( 'timeout' => 10, 'check' => array('get', 'post', 'cookie', 'referer', 'user_agent'), ); public function __construct($proxyCheckUrl, array $config = array()) { $this->proxyCheckUrl = $proxyCheckUrl; $this->setConfig($config); } public function setConfig(array $config) { $this->config = array_merge($this->config, $config); } public function checkProxies(array $proxies) { $results = array(); foreach ($proxies as $proxy) { try { $results[$proxy] = $this->checkProxy($proxy); } catch (\Exception $e) { $results[$proxy]['error'] = $e->getMessage(); } } return $results; } public function checkProxy($proxy) { list($content, $info) = $this->getProxyContent($proxy); return $this->checkProxyContent($content, $info); } private function getProxyContent($proxy) { @list($proxyIp, $proxyPassword, $proxyType) = explode(',', $proxy); $ch = \curl_init(); $url = $this->proxyCheckUrl; // check query if (in_array('get', $this->config['check'])) { $url .= '?q=query'; } $options = array( CURLOPT_URL => $url, CURLOPT_PROXY => $proxyIp, CURLOPT_HEADER => true, CURLOPT_TIMEOUT => $this->config['timeout'], CURLOPT_CONNECTTIMEOUT => $this->config['timeout'], CURLOPT_RETURNTRANSFER => true ); if (!empty($proxyPassword)) { $options[CURLOPT_PROXYAUTH] = CURLAUTH_BASIC; $options[CURLOPT_PROXYUSERPWD] = $proxyPassword; } // check post if (in_array('post', $this->config['check'])) { $options[CURLOPT_POST] = true; $options[CURLOPT_POSTFIELDS] = array( 'r' => 'request' ); } // check cookie if (in_array('cookie', $this->config['check'])) { $options[CURLOPT_COOKIE] = 'c=cookie'; } // check refderer if (in_array('referer', $this->config['check'])) { $options[CURLOPT_REFERER] = 'http://www.google.com'; } // check user agent if (in_array('user_agent', $this->config['check'])) { $options[CURLOPT_USERAGENT] = 'Mozila/4.0'; } if (!empty($proxyType)) { if ('http' == $proxyType) { $options[CURLOPT_PROXYTYPE] = CURLPROXY_HTTP; } else if ('socks4' == $proxyType) { $options[CURLOPT_PROXYTYPE] = CURLPROXY_SOCKS4; } else if ('socks5' == $proxyType) { $options[CURLOPT_PROXYTYPE] = CURLPROXY_SOCKS5; } } \curl_setopt_array($ch, $options); $content = \curl_exec($ch); $info = \curl_getinfo($ch); return array($content, $info); } private function checkProxyContent($content, $info) { if (!$content) { throw new \Exception('Empty content'); } if (!strpos($content, 'check this string in proxy response content')) { throw new \Exception('Wrong content'); } if (200 !== $info['http_code']) { throw new \Exception('Code invalid: ' . $info['http_code']); } $allowed = array(); $disallowed = array(); foreach ($this->config['check'] as $value) { if (strpos($content, "allow_$value")) { $allowed[] = $value; } else { $disallowed[] = $value; } } // proxy level $proxyLevel = ''; if (strpos($content, 'proxylevel_elite')) { $proxyLevel = 'elite'; } elseif (strpos($content, 'proxylevel_anonymous')) { $proxyLevel = 'anonymous'; } elseif (strpos($content, 'proxylevel_transparent')) { $proxyLevel = 'transparent'; } return array( 'allowed' => $allowed, 'disallowed' => $disallowed, 'proxy_level' => $proxyLevel, 'info' => $info ); } $pingUrl = 'http://yourdomain.com/ProxyChecker/ping.php'; $proxyChecker = new ProxyChecker($pingUrl); $proxies = array( '183.95.132.76:80', '195.5.18.41:8118', ); $results = $proxyChecker->checkProxies($proxies); echo '<pre>'; var_export($results); echo '</pre'; }

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.4.270.0070.05512.47
5.4.260.0100.04312.47
5.4.250.0070.04112.48
5.4.240.0060.04012.48
5.4.230.0080.03712.47
5.4.220.0050.03912.47
5.4.210.0040.04412.48
5.4.200.0080.04212.47
5.4.190.0110.03712.46
5.4.180.0060.03812.46
5.4.170.0070.03612.47
5.4.160.0070.03612.46
5.4.150.0050.04612.46
5.4.140.0090.03812.15
5.4.130.0080.04112.13
5.4.120.0070.03712.09
5.4.110.0100.03612.09
5.4.100.0080.04212.09
5.4.90.0100.05212.10
5.4.80.0060.04512.09
5.4.70.0080.03912.09
5.4.60.0110.04212.09
5.4.50.0100.03612.09
5.4.40.0030.04112.08
5.4.30.0090.03812.07
5.4.20.0050.03712.07
5.4.10.0060.03612.07
5.4.00.0050.03911.57
5.3.280.0070.03912.71
5.3.270.0070.04612.72
5.3.260.0070.04612.72
5.3.250.0040.04612.72
5.3.240.0030.04712.72
5.3.230.0110.04712.71
5.3.220.0100.04112.68
5.3.210.0090.04512.68
5.3.200.0070.03912.68
5.3.190.0070.03612.68
5.3.180.0070.03812.67
5.3.170.0100.03812.67
5.3.160.0090.04312.67
5.3.150.0070.04612.67
5.3.140.0100.04812.67
5.3.130.0120.05412.66
5.3.120.0080.04312.66
5.3.110.0050.04212.66
5.3.100.0110.04812.14
5.3.90.0040.04212.12
5.3.80.0070.03912.11
5.3.70.0100.07512.11
5.3.60.0080.04712.09
5.3.50.0070.04712.04
5.3.40.0070.04112.04
5.3.30.0050.04112.01
5.3.20.0090.04111.79
5.3.10.0070.04411.75
5.3.00.0120.05511.74

preferences:
140.24 ms | 1394 KiB | 7 Q