3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* * This file is part of the SensioLabsProfiler SDK package. * * (c) SensioLabs <contact@sensiolabs.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */class SprofilerHttpWrapper extends php_user_filter{ public $context; private $sslContext = array( 'SNI_server_name' => 'profiler.sensiolabs.com', ); private $socket; public function stream_open($path, $mode) { if ('wb' !== $mode) { return false; } $url = "ssl://{$this->sslContext['SNI_server_name']}:443"; $context = array('ssl' => $this->sslContext); $this->socket = stream_socket_client($url, $errno, $errmsg, 15, STREAM_CLIENT_CONNECT, stream_context_create($context)); stream_set_timeout($this->socket, 5); if (!$this->socket) { user_error($errmsg); return false; } if (!in_array('sprofiler.chunk', stream_get_filters())) { stream_filter_register('sprofiler.chunk', __CLASS__); } return true; } public function stream_write($data) { if (!$this->params) { $boundary = md5(mt_rand()*mt_rand()).md5(mt_rand()*mt_rand()); $this->params = compact('boundary'); $serverId = ''; $slotId = ''; $authToken = ''; $post = array(); foreach (explode("\n", $data) as $field) { $field = explode(":", $field, 2); switch ($field[0]) { case 'SensioLabsProfiler-Query': $authToken = trim($field[1]); parse_str($authToken, $field); foreach ($field as $k => $v) { if ('agentIds' === $k) { $v = explode(',', $v); $authToken = $v[0].':'.$authToken; foreach ($v as $v) { $post[] = array('agents[]', $v); } } else { if ('profileSlot' === $k) { $slotId = $v; } $post[] = array($k, $v); } } $authToken = base64_encode($authToken); break; case 'SensioLabsProfiler-Auth': $serverId = trim($field[1]); $serverId = "X-{$field[0]}: {$field[1]}\r\n"; break; } } $http = "POST /agent-api/v1/profile-slots/{$slotId} HTTP/1.1\r\n" ."Host: {$this->sslContext['SNI_server_name']}\r\n" ."User-Agent: SensioLabsProfiler-SDK\r\n" ."Authorization: Basic {$authToken}\r\n" ."Content-Type: multipart/form-data; boundary={$boundary}\r\n" ."Transfer-Encoding: chunked\r\n" .$serverId ."\r\n"; if (!$w = fwrite($this->socket, $http)) { return $w; } stream_filter_append($this->socket, 'sprofiler.chunk', STREAM_FILTER_WRITE, $this->params); $http = ''; foreach ($post as $field) { $http .= '--'.$boundary."\r\n" .'Content-Disposition: form-data; name="'.$field[0].'"'."\r\n" ."\r\n" .$field[1]."\r\n"; } $http .= '--'.$boundary."\r\n" ."Content-Disposition: form-data; name=\"payload\"; filename=\"graph.dat\"\r\n" ."Content-Type: application/octet-stream\r\n" ."\r\n"; if (!$w = fwrite($this->socket, $http)) { return $w; } if (in_array('zlib.*', stream_get_filters())) { stream_filter_prepend($this->socket, 'zlib.deflate', STREAM_FILTER_WRITE); } } elseif (!$w = fwrite($this->socket, $data)) { return $w; } return strlen($data); } public function stream_flush() { return fflush($this->socket); } public function stream_close() { fclose($this->socket); $this->socket = $this->params = null; } public function stream_lock() { return false; } public function filter($in, $out, &$consumed, $closing) { while ($bucket = stream_bucket_make_writeable($in)) { $consumed += $bucket->datalen; $bucket->data = dechex($bucket->datalen)."\r\n{$bucket->data}\r\n"; stream_bucket_append($out, $bucket); } if ($closing) { $data = "--{$this->params['boundary']}--\r\n"; $data = dechex(strlen($data))."\r\n{$data}\r\n0\r\n\r\n"; stream_bucket_append($out, stream_bucket_new($this->stream, $data)); } return PSFS_PASS_ON; }}

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.4.10.0100.00714.75
7.4.00.0060.01214.84
7.3.130.0050.01214.50
7.3.120.0100.01014.64
7.3.110.0070.01214.40
7.3.100.0050.00714.55
7.3.90.0000.01214.53
7.3.80.0060.00614.66
7.3.70.0060.00714.68
7.3.60.0050.00714.65
7.3.50.0040.01214.68
7.3.40.0050.00714.47
7.3.30.0070.00514.63
7.3.20.0030.01316.31
7.3.10.0060.00516.45
7.3.00.0050.00816.40
7.2.260.0100.00914.87
7.2.250.0070.01214.90
7.2.240.0050.01014.85
7.2.230.0070.00714.83
7.2.220.0030.01214.59
7.2.210.0050.00714.75
7.2.200.0040.00814.83
7.2.190.0080.00614.79
7.2.180.0090.00614.91
7.2.170.0050.00614.83
7.2.160.0060.00914.84
7.2.150.0070.00716.55
7.2.140.0050.00916.70
7.2.130.0060.00816.52
7.2.120.0050.00916.61
7.2.110.0090.00716.44
7.2.100.0090.00516.47
7.2.90.0040.01016.58
7.2.80.0070.00816.60
7.2.70.0030.00816.66
7.2.60.0030.00816.54
7.2.50.0060.00816.63
7.2.40.0070.00616.60
7.2.30.0040.01016.51
7.2.20.0070.00716.78
7.2.10.0030.00916.54
7.2.00.0010.01316.63
7.1.330.0060.00615.41
7.1.320.0030.00715.60
7.1.310.0030.00915.45
7.1.300.0040.00815.51
7.1.290.0060.00915.38
7.1.280.0030.01015.59
7.1.270.0070.00515.66
7.1.260.0040.00815.40
7.1.250.0030.00915.36
7.1.240.0080.00515.36
7.1.230.0110.00415.49
7.1.220.0060.00715.33
7.1.210.0050.00715.52
7.1.200.0060.00715.52
7.1.190.0050.00515.54
7.1.180.0080.00715.41
7.1.170.0060.00515.33
7.1.160.0040.00915.65
7.1.150.0070.00515.61
7.1.140.0090.00615.45
7.1.130.0060.00915.52
7.1.120.0040.00815.57
7.1.110.0060.00715.49
7.1.100.0050.00915.58
7.1.90.0020.00915.51
7.1.80.0060.00715.64
7.1.70.0080.00415.72
7.1.60.0060.01016.44
7.1.50.0060.00815.88
7.1.40.0080.00415.54
7.1.30.0050.00915.61
7.1.20.0080.00815.56
7.1.10.0100.00515.48
7.1.00.0070.02517.24
7.0.330.0050.00715.07
7.0.320.0100.00515.03
7.0.310.0090.00515.24
7.0.300.0040.01115.24
7.0.290.0050.00815.10
7.0.280.0030.01015.15
7.0.270.0080.00815.16
7.0.260.0080.00414.98
7.0.250.0070.00515.17
7.0.240.0020.01015.13
7.0.230.0060.00715.33
7.0.220.0050.00715.24
7.0.210.0050.00815.22
7.0.200.0060.00715.55
7.0.190.0070.00415.29
7.0.180.0060.00515.14
7.0.170.0060.00615.07
7.0.160.0090.00515.03
7.0.150.0080.00715.07
7.0.140.0060.02417.04
7.0.130.0060.00615.07
7.0.120.0030.01015.34
7.0.110.0060.00715.14
7.0.100.0050.01416.41
7.0.90.0020.01816.41
7.0.80.0040.01716.44
7.0.70.0090.01316.29
7.0.60.0020.02016.38
7.0.50.0050.01916.41
7.0.40.0060.02114.79
7.0.30.0070.02314.74
7.0.20.0060.02514.94
7.0.10.0030.01714.87
7.0.00.0060.02614.88
5.6.400.0050.00814.21
5.6.390.0030.00814.29
5.6.380.0080.00314.08
5.6.370.0040.00714.19
5.6.360.0060.00713.99
5.6.350.0050.00614.10
5.6.340.0080.00714.18
5.6.330.0050.00614.11
5.6.320.0130.00213.98
5.6.310.0040.00714.21
5.6.300.0090.00614.10
5.6.290.0060.00713.98
5.6.280.0080.02315.81
5.6.270.0040.00713.96
5.6.260.0020.01014.06
5.6.250.0060.01615.86
5.6.240.0050.02215.71
5.6.230.0070.01615.75
5.6.220.0060.01715.65
5.6.210.0060.01615.57
5.6.200.0030.02615.79
5.6.190.0070.01515.85
5.6.180.0040.02515.93
5.6.170.0060.02415.58
5.6.160.0090.02515.74
5.6.150.0030.02915.89
5.6.140.0090.02515.89
5.6.130.0060.02415.92
5.6.120.0110.02015.76
5.6.110.0080.02315.81
5.6.100.0050.02715.73
5.6.90.0060.02415.73
5.6.80.0100.02315.64
5.6.70.0050.02715.56
5.6.60.0090.02315.46
5.6.50.0020.02315.52
5.6.40.0090.01515.69
5.6.30.0120.02215.69
5.6.20.0040.02815.66
5.6.10.0050.02415.53
5.6.00.0070.02515.50
5.5.380.0020.01714.90
5.5.370.0070.01514.77
5.5.360.0070.01414.96
5.5.350.0030.01614.81
5.5.340.0040.01514.79
5.5.330.0030.01514.83
5.5.320.0080.01415.07
5.5.310.0050.01614.83
5.5.300.0050.02614.84
5.5.290.0090.02214.94
5.5.280.0060.02014.77
5.5.270.0100.02115.00
5.5.260.0060.02514.86
5.5.250.0060.02314.63
5.5.240.0070.02614.83
5.5.230.0060.02314.79
5.5.220.0060.02514.67
5.5.210.0030.02914.68
5.5.200.0060.02414.79
5.5.190.0080.02214.84
5.5.180.0050.02914.73
5.5.170.0060.00813.00
5.5.160.0050.02514.81
5.5.150.0040.02714.83
5.5.140.0090.01914.74
5.5.130.0080.02214.77
5.5.120.0030.02414.81
5.5.110.0090.02214.77
5.5.100.0070.02314.79
5.5.90.0060.02614.63
5.5.80.0090.02214.76
5.5.70.0080.02214.48
5.5.60.0080.02214.65
5.5.50.0070.02014.60
5.5.40.0050.01914.70
5.5.30.0080.02114.65
5.5.20.0080.02114.60
5.5.10.0060.02614.59
5.5.00.0060.02714.61
5.4.450.0070.01313.38
5.4.440.0050.01813.46
5.4.430.0040.02313.32
5.4.420.0080.02213.29
5.4.410.0010.02313.25
5.4.400.0090.02213.19
5.4.390.0060.02413.25
5.4.380.0040.02313.25
5.4.370.0060.02313.20
5.4.360.0060.02413.29
5.4.350.0060.02313.29
5.4.340.0060.02513.29
5.4.330.0040.00711.36
5.4.320.0070.01613.28
5.4.310.0070.02313.32
5.4.300.0080.02113.14
5.4.290.0060.02313.24
5.4.280.0070.02213.28
5.4.270.0060.02213.26
5.4.260.0090.02013.24
5.4.250.0050.02313.28
5.4.240.0030.02613.26
5.4.230.0080.01713.21
5.4.220.0020.02713.18
5.4.210.0040.02613.24
5.4.200.0040.02513.16
5.4.190.0050.01513.29
5.4.180.0060.02213.24
5.4.170.0070.02113.22
5.4.160.0040.01913.24
5.4.150.0050.02613.33
5.4.140.0050.02212.55
5.4.130.0060.01912.62
5.4.120.0070.01612.66
5.4.110.0050.02412.66
5.4.100.0050.01612.66
5.4.90.0070.02112.58
5.4.80.0100.02012.60
5.4.70.0070.02312.65
5.4.60.0040.02212.53
5.4.50.0050.02512.56
5.4.40.0040.02312.60
5.4.30.0070.02212.64
5.4.20.0060.02312.64
5.4.10.0040.02312.61
5.4.00.0060.01912.47

preferences:
31.94 ms | 400 KiB | 5 Q