3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Handles Memcache Sessions * * @property Memcache $pool Memcache Object */ class MemcacheSessionModule /*implements \SessionHandlerInterface */ { const UNIX_PREFIX = 'unix://'; const FILE_PREFIX = 'file://'; const TCP_PREFIX = 'tcp://'; const SCHEME_FILE = 'file'; const SCHEME_TCP = 'tcp'; const SCHEME_UNIX = 'unix'; const ZERO_PORT = ':0'; /** * Our Memcache Pool * @var Memcache */ private $pool; public function __construct() { $this->pool = new Memcache; } public function close() { return $this->pool->close(); } public function destroy($sessionId) { } public function gc($maxLifetime) { } public function open($savePath, $name) { $serverList = self::parseSavePath($savePath); if (!$serverList) { return false; } foreach ($serverList as $serverInfo) { $this->pool->addserver( $serverInfo['host'], $serverInfo['port'], $serverInfo['persistent'], $serverInfo['weight'], $serverInfo['timeout'], $serverInfo['retry_interval'] ); } return true; } public function read($sessionId) { } public function write($sessionId, $data) { } private static function parseSavePath($savePath) { if (empty($savePath)) { trigger_error( "Failed to parse session.save_path (empty save_path)", E_WARNING); return false; } $serverList = explode(',', $savePath); $return = array(); foreach ($serverList as $url) { $url = strtolower($url); // Swap unix:// to file:// for parse_url if (substr($url, 0, strlen(self::UNIX_PREFIX)) === self::UNIX_PREFIX) { $url = self::FILE_PREFIX . substr($url, strlen(self::UNIX_PREFIX)); } $parsedUrlData = parse_url($url); if (!$parsedUrlData) { trigger_error("Failed to parse session.save_path (unable to parse " . "url, url was '" . $url . "')", E_WARNING); return false; } // Init optional values $serverInfo = array( 'persistent' => null, 'weight' => null, 'timeout' => null, 'retry_interval' => null ); switch ($parsedUrlData['scheme']) { case self::SCHEME_FILE: if (substr($parsedUrlData['path'], -2) === self::ZERO_PORT) { $parsedUrlData['path'] = substr($parsedUrlData['path'], 0, -2); } $serverInfo['host'] = self::SCHEME_UNIX . $parsedUrlData['path']; $serverInfo['port'] = 0; break; case self::SCHEME_TCP: $serverInfo['host'] = self::SCHEME_TCP . $parsedUrlData['host']; if (array_key_exists('port', $parsedUrlData)) { $serverInfo['port'] = $parsedUrlData['port']; } else { $serverInfo['port'] = (int)ini_get('memcache.default_port'); } break; default: trigger_error("Failed to parse session.save_path (unknown protocol," . " url was '" . $url . "')", E_WARNING); return false; } if (array_key_exists('query', $parsedUrlData)) { $optionList = array(); parse_str($parsedUrlData['query'], $optionList); if (count($optionList) > 0) { foreach ($optionList as $key => $value) { switch ($key) { case 'persistent': $serverInfo[$key] = (bool)$value; break; case 'weight': case 'timeout': case 'retry_interval': $serverInfo[$key] = (int)$value; break; } } } } $return[] = $serverInfo; } return $return; } } $session = new MemcacheSessionModule; $session->open('unix:///var/run/memcache.sock?weight=123,tcp://127.0.0.1:11211?weight=1&persistent=1&timeout=4');

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.60.0170.00318.31
8.3.50.0120.00721.93
8.3.40.0120.00318.86
8.3.30.0070.01119.10
8.3.20.0080.00020.34
8.3.10.0050.00323.57
8.3.00.0060.00317.59
8.2.180.0090.00618.41
8.2.170.0070.00722.96
8.2.160.0170.00020.46
8.2.150.0090.00024.18
8.2.140.0000.00824.66
8.2.130.0110.00326.16
8.2.120.0000.00722.27
8.2.110.0030.00722.25
8.2.100.0040.00817.91
8.2.90.0060.00617.84
8.2.80.0080.00017.97
8.2.70.0000.00817.50
8.2.60.0040.00417.93
8.2.50.0050.00518.07
8.2.40.0040.00419.76
8.2.30.0060.00318.19
8.2.20.0030.00617.73
8.2.10.0000.00817.93
8.2.00.0080.00017.77
8.1.280.0170.00325.92
8.1.270.0000.00823.80
8.1.260.0000.00826.35
8.1.250.0080.00028.09
8.1.240.0050.00519.00
8.1.230.0040.00720.95
8.1.220.0000.00817.74
8.1.210.0050.00318.77
8.1.200.0050.00517.23
8.1.190.0040.00417.22
8.1.180.0050.00318.10
8.1.170.0090.00018.51
8.1.160.0030.00522.05
8.1.150.0030.00518.80
8.1.140.0000.00717.23
8.1.130.0000.00717.77
8.1.120.0000.00717.38
8.1.110.0040.00417.30
8.1.100.0000.00717.41
8.1.90.0070.00317.27
8.1.80.0050.00317.40
8.1.70.0000.00717.20
8.1.60.0050.00517.59
8.1.50.0030.00517.50
8.1.40.0000.00917.53
8.1.30.0040.00417.57
8.1.20.0080.00017.48
8.1.10.0060.00317.59
8.1.00.0030.00517.47
8.0.300.0060.00320.28
8.0.290.0030.00516.75
8.0.280.0000.00718.45
8.0.270.0030.00317.29
8.0.260.0070.00017.27
8.0.250.0000.00716.96
8.0.240.0030.00517.05
8.0.230.0000.00817.02
8.0.220.0000.00716.97
8.0.210.0030.00316.81
8.0.200.0000.00717.00
8.0.190.0040.00416.90
8.0.180.0040.00416.98
8.0.170.0040.00416.90
8.0.160.0030.00316.91
8.0.150.0070.00016.84
8.0.140.0000.00716.82
8.0.130.0060.00013.40
8.0.120.0040.00416.87
8.0.110.0040.00416.90
8.0.100.0080.00016.91
8.0.90.0050.00216.85
8.0.80.0060.01216.93
8.0.70.0040.00416.76
8.0.60.0000.00716.97
8.0.50.0030.00516.98
8.0.30.0130.00816.99
8.0.20.0100.01317.40
8.0.10.0040.00416.88
8.0.00.0080.00916.77
7.4.330.0020.00215.02
7.4.320.0060.00016.51
7.4.300.0000.00616.39
7.4.290.0030.00316.51
7.4.280.0040.00416.38
7.4.270.0000.00816.53
7.4.260.0000.00716.61
7.4.250.0040.00416.56
7.4.240.0060.00116.56
7.4.230.0040.00416.31
7.4.220.0110.00716.44
7.4.210.0060.01016.60
7.4.200.0070.00016.40
7.4.160.0180.00616.45
7.4.150.0090.00917.40
7.4.140.0070.01017.86
7.4.130.0090.00816.45
7.4.120.0110.00616.65
7.4.110.0160.00416.73
7.4.100.0070.01116.40
7.4.90.0000.01716.53
7.4.80.0150.00619.39
7.4.70.0100.00616.64
7.4.60.0130.00316.58
7.4.50.0000.00716.47
7.4.40.0070.01016.55
7.4.30.0140.00316.59
7.4.00.0050.01214.95
7.3.330.0050.00013.40
7.3.320.0000.00713.45
7.3.310.0000.00816.25
7.3.300.0000.00816.45
7.3.290.0080.00616.45
7.3.280.0080.01016.38
7.3.270.0070.01017.40
7.3.260.0100.01016.67
7.3.250.0090.01016.68
7.3.240.0100.00716.44
7.3.230.0130.00316.39
7.3.210.0170.00316.50
7.3.200.0090.01019.39
7.3.190.0110.00816.37
7.3.180.0090.00616.50
7.3.170.0060.01016.59
7.3.160.0130.00316.57
7.3.120.0050.01314.93
7.3.110.0030.01014.90
7.3.100.0050.00914.77
7.3.90.0030.01114.83
7.3.80.0050.01114.98
7.3.70.0060.00514.76
7.3.60.0020.01414.90
7.3.50.0050.00514.65
7.3.40.0100.00514.79
7.3.30.0080.00614.74
7.3.20.0060.00516.57
7.3.10.0070.00416.39
7.3.00.0060.00716.47
7.2.330.0060.01216.39
7.2.320.0170.00016.58
7.2.310.0160.00616.74
7.2.300.0070.01716.32
7.2.290.0110.00616.68
7.2.250.0070.01014.77
7.2.240.0030.01114.85
7.2.230.0060.01114.98
7.2.220.0000.01014.94
7.2.210.0050.01114.94
7.2.200.0050.00914.88
7.2.190.0020.01014.83
7.2.180.0050.00715.05
7.2.170.0050.00814.67
7.2.160.0100.00314.82
7.2.150.0030.01316.79
7.2.140.0000.01316.86
7.2.130.0080.00916.73
7.2.120.0060.00816.78
7.2.110.0060.00616.70
7.2.100.0100.00616.72
7.2.90.0130.00316.76
7.2.80.0030.01116.69
7.2.70.0110.00716.67
7.2.60.0050.00916.81
7.2.50.0040.01116.84
7.2.40.0090.01016.87
7.2.30.0080.00916.74
7.2.20.0070.00816.76
7.2.10.0070.00716.77
7.2.00.0060.00617.38
7.1.330.0050.01215.47
7.1.320.0030.01015.50
7.1.310.0070.00815.71
7.1.300.0000.01115.33
7.1.290.0000.01115.56
7.1.280.0050.00915.56
7.1.270.0080.00615.55
7.1.260.0030.00815.56
7.1.250.0020.01215.53
7.1.240.0060.00615.67
7.1.230.0030.01015.76
7.1.220.0090.00315.70
7.1.210.0090.00015.42
7.1.200.0050.00715.34
7.1.190.0060.00615.77
7.1.180.0000.01215.43
7.1.170.0120.00415.54
7.1.160.0070.00715.76
7.1.150.0100.00315.62
7.1.140.0060.00615.68
7.1.130.0030.00515.36
7.1.120.0070.01015.57
7.1.110.0030.01215.60
7.1.100.0040.00716.82
7.1.90.0030.00615.45
7.1.80.0030.00915.74
7.1.70.0030.01016.20
7.1.60.0040.01417.50
7.1.50.0060.00716.11
7.1.40.0110.00415.34
7.1.30.0050.00815.69
7.1.20.0000.01215.66
7.1.10.0100.00615.59
7.1.00.0080.04019.00
7.0.330.0000.01715.34
7.0.320.0030.00515.24
7.0.310.0000.01215.23
7.0.300.0100.00715.26
7.0.290.0030.00515.26
7.0.280.0070.00315.27
7.0.270.0110.00015.40
7.0.260.0000.01415.27
7.0.250.0100.00315.21
7.0.240.0040.00415.20
7.0.230.0000.01215.39
7.0.220.0120.00315.41
7.0.210.0030.00515.09
7.0.200.0040.00815.85
7.0.190.0000.01514.98
7.0.180.0070.00715.00
7.0.170.0080.00815.16
7.0.160.0040.01115.38
7.0.150.0040.01115.36
7.0.140.0060.03818.68
7.0.130.0030.01015.46
7.0.120.0070.00715.20
7.0.110.0070.00715.37
7.0.100.0090.00615.25
7.0.90.0030.01215.27
7.0.80.0000.01515.25
7.0.70.0090.00415.32
7.0.60.0060.04117.70
7.0.50.0050.02516.56
7.0.40.0030.02716.58
7.0.30.0120.03316.84
7.0.20.0140.04116.76
7.0.10.0110.03816.82
7.0.00.0150.03716.70
5.6.400.0060.00914.56
5.6.390.0080.01114.65
5.6.380.0050.00514.59
5.6.370.0030.01114.11
5.6.360.0030.01314.14
5.6.350.0030.00914.32
5.6.340.0000.00914.29
5.6.330.0040.00414.33
5.6.320.0040.01114.10
5.6.310.0000.01214.23
5.6.300.0060.01214.21
5.6.290.0070.01014.46
5.6.280.0050.04017.85
5.6.270.0030.01014.35
5.6.260.0030.01014.13
5.6.250.0040.01114.21
5.6.240.0000.01114.38
5.6.230.0110.00414.20
5.6.220.0030.00713.95
5.6.210.0030.05017.45
5.6.200.0070.04116.10
5.6.190.0050.02417.38
5.6.180.0020.05017.33
5.6.170.0120.03217.48
5.6.160.0110.03217.43
5.6.150.0080.04116.20
5.6.140.0110.04216.18
5.6.130.0070.02916.17
5.6.120.0050.04717.59
5.6.110.0030.02717.68
5.6.100.0070.04717.64
5.6.90.0050.04717.74
5.6.80.0090.04217.18
5.6.70.1780.01817.19
5.6.60.0070.00714.36
5.6.50.0000.01114.19
5.6.40.0040.00814.12
5.6.30.0080.00814.16
5.6.20.0070.01013.97
5.6.10.0000.01414.23
5.6.00.0030.01314.19
5.5.380.0000.00913.90
5.5.370.0030.01014.41
5.5.360.0070.00714.34
5.5.350.0050.03517.46
5.5.340.0070.02716.16
5.5.330.0070.04217.31
5.5.320.0260.04017.28
5.5.310.0100.02817.08
5.5.300.0000.02716.03
5.5.290.0030.04916.21
5.5.280.0030.02317.70
5.5.270.0100.03817.57
5.5.260.0050.04817.47
5.5.250.0120.03017.25
5.5.240.0100.01917.20
5.5.230.0040.01114.21
5.5.220.0030.00814.40
5.5.210.0140.00014.31
5.5.200.0000.01313.90
5.5.190.0000.01414.04
5.5.180.0030.00514.16
5.5.170.0040.00414.18
5.5.160.0130.00313.82
5.5.150.0000.01414.12
5.5.140.0110.00314.00
5.5.130.0100.00314.20
5.5.120.0090.00914.19
5.5.110.0000.01214.36
5.5.100.0060.01313.89
5.5.90.0040.01414.34
5.5.80.0110.00614.00
5.5.70.0030.00614.03
5.5.60.0110.00414.26
5.5.50.0030.00914.26
5.5.40.0000.01314.23
5.5.30.0030.01013.67
5.5.20.0050.00514.00
5.5.10.0030.00713.89
5.5.00.0030.01314.29
5.4.450.0200.02515.18
5.4.440.0350.02315.34
5.4.430.0380.02215.23
5.4.420.0420.00415.28
5.4.410.0330.00315.32
5.4.400.0330.00115.17
5.4.390.0350.00315.23
5.4.380.0360.00415.12
5.4.370.0340.00315.19
5.4.360.0320.00515.12
5.4.350.0350.00415.22
5.4.340.0040.02111.62
5.4.330.0100.00311.20
5.4.320.0070.02211.86
5.4.310.0030.02411.86
5.4.300.0070.01711.87
5.4.290.0060.02011.86
5.4.280.0060.02211.81
5.4.270.0110.01911.81
5.4.260.0060.02111.81
5.4.250.0070.02211.81
5.4.240.0080.01811.81
5.4.230.0060.02411.81
5.4.220.0040.02211.81
5.4.210.0100.01711.80
5.4.200.0070.02011.81
5.4.190.0080.01711.80
5.4.180.0040.02311.80
5.4.170.0040.01911.81
5.4.160.0080.01911.81
5.4.150.0050.02211.81
5.4.140.0090.01811.65
5.4.130.0100.01811.64
5.4.120.0050.02111.62
5.4.110.0060.02111.62
5.4.100.0090.01811.62
5.4.90.0090.02311.62
5.4.80.0090.01911.62
5.4.70.0040.01911.62
5.4.60.0050.02211.62
5.4.50.0090.01811.62
5.4.40.0080.01811.61
5.4.30.0080.02611.61
5.4.20.0090.01911.61
5.4.10.0040.02411.61
5.4.00.0070.01911.36
5.3.290.0090.03612.80
5.3.280.0130.03112.71
5.3.270.0100.04012.73
5.3.260.0070.04412.74
5.3.250.0120.03112.73
5.3.240.0040.03812.73
5.3.230.0100.04012.71
5.3.220.0080.03412.68
5.3.210.0070.03712.68
5.3.200.0090.03312.69
5.3.190.0090.03412.69
5.3.180.0060.03612.68
5.3.170.0080.03412.68
5.3.160.0130.03012.68
5.3.150.0050.03812.68
5.3.140.0140.02912.68
5.3.130.0090.03612.67
5.3.120.0130.03812.67
5.3.110.0090.03512.66
5.3.100.0100.03212.16
5.3.90.0090.03312.14
5.3.80.0070.04012.13
5.3.70.0080.03512.13
5.3.60.0090.03412.12
5.3.50.0090.03412.07
5.3.40.0100.03412.07
5.3.30.0150.02712.02
5.3.20.0070.03511.80
5.3.10.0100.03011.77
5.3.00.0070.03511.76
5.2.170.0090.0319.27
5.2.160.0100.0269.27
5.2.150.0060.0299.27
5.2.140.0090.0329.27
5.2.130.0060.0339.22
5.2.120.0070.0279.22
5.2.110.0100.0299.23
5.2.100.0050.0319.23
5.2.90.0050.0379.23
5.2.80.0090.0269.22
5.2.70.0080.0279.22
5.2.60.0050.0309.18
5.2.50.0090.0279.14
5.2.40.0100.0319.12
5.2.30.0040.0339.10
5.2.20.0070.0289.08
5.2.10.0050.0298.99
5.2.00.0090.0258.85
5.1.60.0090.0198.13
5.1.50.0090.0208.13
5.1.40.0090.0288.11
5.1.30.0080.0228.46
5.1.20.0070.0318.48
5.1.10.0050.0288.21
5.1.00.0080.0238.21
5.0.50.0060.0276.70
5.0.40.0050.0176.55
5.0.30.0050.0296.37
5.0.20.0050.0186.34
5.0.10.0030.0206.31
5.0.00.0060.0296.30
4.4.90.0040.0134.78
4.4.80.0040.0194.76
4.4.70.0020.0214.75
4.4.60.0050.0164.75
4.4.50.0070.0144.77
4.4.40.0010.0264.71
4.4.30.0060.0204.76
4.4.20.0020.0164.85
4.4.10.0030.0214.85
4.4.00.0050.0264.75
4.3.110.0030.0204.67
4.3.100.0000.0174.66
4.3.90.0020.0154.63
4.3.80.0030.0254.58
4.3.70.0040.0134.63
4.3.60.0010.0184.63
4.3.50.0060.0214.63
4.3.40.0020.0234.54
4.3.30.0030.0233.30
4.3.20.0030.0233.28
4.3.10.0040.0143.23
4.3.00.0030.0139.89

preferences:
53.87 ms | 401 KiB | 5 Q