3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bitfinex { private $api_key; private $api_secret; private $api_version; private $base_url = 'https://api.bitfinex.com'; public function __construct($api_key, $api_secret, $api_version = 'v1') { $this->api_key = $api_key; $this->api_secret = $api_secret; $this->api_version = $api_version; } public function new_offer($currency, $amount, $rate, $period, $direction = "lend") { $request = '/' . $this->api_version . '/offer/new'; $data = array( 'request' => $request, 'currency' => $currency, 'amount' => $amount, 'rate' => $rate, 'period' => $period, 'direction' => $direction ); return $this->send_signed_request($data); } public function cancel_offer($offer_id) { $request = '/' . $this->api_version . '/offer/cancel'; $data = array( 'request' => $request, 'offer_id' => $offer_id ); return $this->send_signed_request($data); } public function get_offer($offer_id) { $request = '/' . $this->api_version . '/offer/status'; $data = array( 'request' => $request, 'offer_id' => $offer_id ); return $this->send_signed_request($data); } public function get_trades() { $request = '/' . $this->api_version . '/trades/btcusd'; $data = array( 'request' => $request, 'options' => array() ); return $this->send_signed_request($data); } public function get_offers() { $request = '/' . $this->api_version . '/offers'; $data = array( 'request' => $request, 'options' => array() ); return $this->send_signed_request($data); } public function get_credits() { $request = '/' . $this->api_version . '/credits'; $data = array( 'request' => $request, 'options' => array() ); return $this->send_signed_request($data); } public function get_balances() { $request = '/' . $this->api_version . '/balances'; echo $request; $data = array( 'request' => $request, 'options' => array() ); return $this->send_signed_request($data); } public function get_history($currency, $limit = 1, $wallet = 'trading') { $request = '/' . $this->api_version . '/history'; $data = array( 'request' => $request, 'currency' => $currency, 'limit' => $limit, 'wallet' => $wallet ); return $this->send_signed_request($data); } public function get_lendbook($symbol = "usd") { $request = '/v1/lendbook/' . $symbol; return $this->send_unsigned_request($request); } public function get_lends($symbol = "usd") { $request = '/v1/lends/' . $symbol; return $this->send_unsigned_request($request); } public function get_ticker($symbol = "btcusd") { $request = '/' . $this->api_version . '/ticker/' . $symbol; return $this->send_unsigned_request($request); } private function prepare_header($data) { $data['nonce'] = 144800329405116; //(string) number_format(round(microtime(true) * 100000),0,'.',''); echo $data; echo "Json encode <br/> "; echo json_encode($data); echo "<br/>"; $payload = base64_encode(json_encode($data)); $signature = hash_hmac('sha384', $payload, $this->api_secret); echo "payload"; echo $payload; return array( 'X-BFX-APIKEY: ' . $this->api_key, 'X-BFX-PAYLOAD: ' . $payload, 'X-BFX-SIGNATURE: ' . $signature ); } private function send_signed_request($data) { $ch = curl_init(); $url = $this->base_url . $data['request']; echo $url; $headers = $this->prepare_header($data); curl_setopt_array($ch, array( CURLOPT_URL => $url, CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $headers, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_POSTFIELDS => "" )); // echo $result; if( !$result = curl_exec($ch) ) { echo "NO <br/>"; return false; } else { echo "YES <br/>"; return json_decode($result, true); } } private function send_unsigned_request($request) { $ch = curl_init(); $url = $this->base_url . $request; curl_setopt_array($ch, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false )); if( !$result = curl_exec($ch) ) { echo "NO <br/>"; return false; } else { echo "YES <br/>"; echo $result; echo "<br/>"; return json_decode($result, true); } } } $la = new Bitfinex('1', '1', '1'); $drek = $la->get_balances(); echo '<br/>'; echo 'Recived data'; echo $drek; ?>

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.0040.01116.75
8.3.50.0090.00922.18
8.3.40.0110.00718.83
8.3.30.0060.00918.88
8.3.20.0050.00320.34
8.3.10.0070.00021.89
8.3.00.0050.00319.38
8.2.180.0120.00916.88
8.2.170.0090.00622.96
8.2.160.0110.00320.25
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0080.00017.63
8.2.120.0040.00426.35
8.2.110.0060.00320.36
8.2.100.0040.00817.84
8.2.90.0040.00719.38
8.2.80.0050.00317.97
8.2.70.0060.00317.75
8.2.60.0000.00817.80
8.2.50.0030.00518.07
8.2.40.0080.00019.28
8.2.30.0000.00720.68
8.2.20.0050.00317.89
8.2.10.0000.00718.19
8.2.00.0050.00318.07
8.1.280.0070.01425.92
8.1.270.0040.00423.83
8.1.260.0040.00428.09
8.1.250.0030.00528.09
8.1.240.0050.00523.59
8.1.230.0090.00322.80
8.1.220.0030.00517.91
8.1.210.0050.00518.77
8.1.200.0070.00417.48
8.1.190.0050.00317.72
8.1.180.0040.00418.10
8.1.170.0000.00918.63
8.1.160.0020.00522.05
8.1.150.0030.00518.88
8.1.140.0000.00819.64
8.1.130.0000.00717.70
8.1.120.0060.00517.56
8.1.110.0030.00617.50
8.1.100.0070.00017.54
8.1.90.0070.00017.50
8.1.80.0050.00217.43
8.1.70.0030.00317.52
8.1.60.0050.00317.63
8.1.50.0060.00317.46
8.1.40.0040.00417.50
8.1.30.0000.00817.74
8.1.20.0040.00417.68
8.1.10.0080.00017.55
8.1.00.0040.00417.51
8.0.300.0080.00018.77
8.0.290.0040.00417.00
8.0.280.0000.00718.58
8.0.270.0000.00717.29
8.0.260.0030.00317.33
8.0.250.0030.00317.14
8.0.240.0080.00017.03
8.0.230.0030.00517.07
8.0.220.0030.00717.05
8.0.210.0040.00417.02
8.0.200.0030.00316.98
8.0.190.0070.00016.98
8.0.180.0050.00317.14
8.0.170.0000.00817.07
8.0.160.0070.00017.16
8.0.150.0040.00417.02
8.0.140.0040.00416.84
8.0.130.0060.00013.45
8.0.120.0030.00517.02
8.0.110.0040.00417.01
8.0.100.0000.00817.14
8.0.90.0030.00617.14
8.0.80.0070.01117.00
8.0.70.0040.00417.03
8.0.60.0000.00816.93
8.0.50.0040.00416.88
8.0.30.0120.00616.94
8.0.20.0080.01117.44
8.0.10.0000.00717.10
8.0.00.0070.01216.76
7.4.330.0060.00016.84
7.4.320.0000.00716.55
7.4.300.0000.00616.59
7.4.290.0060.00316.62
7.4.280.0000.01016.50
7.4.270.0040.00416.66
7.4.260.0080.00016.43
7.4.250.0000.00716.64
7.4.240.0000.00716.67
7.4.230.0000.00716.60
7.4.220.0080.01216.75
7.4.210.0150.00316.62
7.4.200.0000.00816.73
7.4.160.0070.01416.64
7.4.150.0130.00417.40
7.4.140.0080.01217.86
7.4.130.0110.00716.63
7.4.120.0090.00916.53
7.4.110.0060.01216.62
7.4.100.0120.01216.83
7.4.90.0100.00716.55
7.4.80.0060.01219.39
7.4.70.0060.01916.52
7.4.60.0060.00916.50
7.4.50.0080.00816.71
7.4.40.0100.00716.71
7.4.30.0150.00916.62
7.4.00.0080.00715.13
7.3.330.0000.00613.23
7.3.320.0030.00313.37
7.3.310.0000.00716.59
7.3.300.0000.00716.45
7.3.290.0040.01016.46
7.3.280.0100.00816.54
7.3.270.0090.00817.40
7.3.260.0090.00916.77
7.3.250.0110.00816.53
7.3.240.0160.00416.65
7.3.230.0060.01216.50
7.3.210.0140.00316.50
7.3.200.0030.01616.78
7.3.190.0160.00616.45
7.3.180.0100.00616.73
7.3.170.0150.00316.44
7.3.160.0090.00616.45
7.3.120.0070.01015.00
7.3.110.0000.01614.59
7.3.100.0060.01215.04
7.3.90.0060.01215.00
7.3.80.0030.01314.64
7.3.70.0070.01014.79
7.3.60.0040.00714.61
7.3.50.0070.01114.91
7.3.40.0060.01014.72
7.3.30.0030.01015.04
7.3.20.0090.00616.73
7.3.10.0120.00916.50
7.3.00.0070.01216.67
7.2.330.0100.01016.81
7.2.320.0100.00716.93
7.2.310.0140.00916.55
7.2.300.0030.01416.56
7.2.290.0070.01116.89
7.2.250.0070.01015.27
7.2.240.0100.00715.04
7.2.230.0080.00815.03
7.2.220.0070.00715.22
7.2.210.0110.00715.07
7.2.200.0030.01015.10
7.2.190.0090.00615.19
7.2.180.0030.01015.09
7.2.170.0060.01115.25
7.2.160.0000.00915.28
7.2.150.0080.00416.89
7.2.140.0040.00716.77
7.2.130.0190.00616.80
7.2.120.0070.01216.97
7.2.110.0210.00816.86
7.2.100.0150.00616.91
7.2.90.0050.01016.73
7.2.80.0090.00616.86
7.2.70.0040.01117.06
7.2.60.0050.01016.89
7.2.50.0090.00716.92
7.2.40.0090.00516.64
7.2.30.0080.00716.89
7.2.20.0020.01016.96
7.2.10.0060.00516.76
7.2.00.0100.00617.72
7.1.330.0100.00915.56
7.1.320.0100.00615.72
7.1.310.0040.01115.86
7.1.300.0040.00715.88
7.1.290.0100.01016.00
7.1.280.0000.01915.69
7.1.270.0070.00715.45
7.1.260.0000.01115.77
7.1.250.0060.01115.67
7.1.240.0100.00315.43
7.1.230.0080.00615.64
7.1.220.0060.00615.75
7.1.210.0040.01115.86
7.1.200.0040.00815.79
7.1.190.0080.00815.68
7.1.180.0070.01015.72
7.1.170.0030.00915.63
7.1.160.0000.01415.68
7.1.150.0070.00715.91
7.1.140.0030.00615.73
7.1.130.0030.01215.95
7.1.120.0040.01115.91
7.1.110.0040.01115.82
7.1.100.0030.00716.99
7.1.90.0110.00415.91
7.1.80.0030.00615.62
7.1.70.0000.01116.32
7.1.60.0070.01517.55
7.1.50.0070.01016.41
7.1.40.0000.01115.95
7.1.30.0000.01415.90
7.1.20.0090.00315.77
7.1.10.0000.01115.60
7.1.00.0140.03219.09
7.0.330.0000.01215.31
7.0.320.0060.00614.98
7.0.310.0040.00415.47
7.0.300.0070.00715.46
7.0.290.0090.00315.18
7.0.280.0090.00615.59
7.0.270.0040.01215.50
7.0.260.0040.00715.28
7.0.250.0030.00915.47
7.0.240.0030.01015.39
7.0.230.0070.00715.47
7.0.220.0030.01015.28
7.0.210.0050.00515.14
7.0.200.0010.00816.01
7.0.190.0000.01115.47
7.0.180.0130.00315.24
7.0.170.0030.01415.19
7.0.160.0080.00815.40
7.0.150.0060.00615.36
7.0.140.0090.00015.12
7.0.130.0000.00915.63
7.0.120.0060.00615.17
7.0.110.0030.00715.25
7.0.100.0000.00815.09
7.0.90.0220.03017.66
7.0.80.0280.03217.64
7.0.70.0330.03717.54
7.0.60.0100.04217.75
7.0.50.0100.03917.80
7.0.40.0100.03416.81
7.0.30.0030.03216.73
7.0.20.0080.03716.70
7.0.10.0070.04316.76
7.0.00.0030.04816.73
5.6.400.0030.00614.64
5.6.390.0040.01114.43
5.6.380.0040.00714.43
5.6.370.0060.00314.38
5.6.360.0030.00614.39
5.6.350.0030.01014.41
5.6.340.0060.00614.50
5.6.330.0120.00314.00
5.6.320.0040.01114.19
5.6.310.0080.00414.13
5.6.300.0060.00614.00
5.6.290.0110.00314.39
5.6.280.0060.00914.14
5.6.270.0000.01114.25
5.6.260.0090.00314.65
5.6.250.0030.00714.41
5.6.240.0050.03117.58
5.6.230.0100.02717.46
5.6.220.0030.02717.46
5.6.210.0120.03817.51
5.6.200.0070.04217.79
5.6.190.0050.04517.63
5.6.180.0110.04217.57
5.6.170.0170.01817.78
5.6.160.0050.04417.77
5.6.150.0070.02817.63
5.6.140.0070.04417.72
5.6.130.0110.04517.78
5.6.120.0080.03617.90
5.6.110.0050.03817.75
5.6.100.0150.03817.49
5.6.90.0050.03217.53
5.6.80.0030.04517.32
5.6.70.0050.03517.27
5.6.60.0070.03017.37
5.6.50.0060.02317.45
5.6.40.0100.02317.50
5.6.30.0090.03717.41
5.6.20.0050.02417.24
5.6.10.0030.04317.25
5.6.00.0080.04117.34
5.5.380.0090.02017.47
5.5.370.0080.04517.50
5.5.360.0030.04517.47
5.5.350.0020.03217.44
5.5.340.0000.03817.57
5.5.330.0050.02517.45
5.5.320.0080.02717.47
5.5.310.0040.04517.59
5.5.300.0090.02917.61
5.5.290.0070.04717.67
5.5.280.0070.04217.49
5.5.270.0100.04217.50
5.5.260.0100.03817.64
5.5.250.0050.02817.49
5.5.240.0050.03217.28
5.5.230.0030.03717.38
5.5.220.0020.02617.09
5.5.210.0120.02717.27
5.5.200.0040.03717.14
5.5.190.0050.03717.36
5.5.180.0050.04317.28
5.5.170.0000.01114.48
5.5.160.0070.04417.40
5.5.150.0070.02817.20
5.5.140.0020.04517.22
5.5.130.0100.02817.25
5.5.120.0020.03517.35
5.5.110.0090.03717.27
5.5.100.0070.04017.11
5.5.90.0030.04217.08
5.5.80.0120.02217.37
5.5.70.0050.04517.23
5.5.60.0030.03517.06
5.5.50.0040.04117.12
5.5.40.0100.04117.13
5.5.30.0040.03717.10
5.5.20.0070.04417.06
5.5.10.0080.04217.04
5.5.00.0080.04316.98

preferences:
59.32 ms | 401 KiB | 5 Q