3v4l.org

run code in 300+ PHP versions simultaneously
<?php /****************************************************************************** Wallet Configuration ******************************************************************************/ $GLOBALS["wallet_ip"] = "127.0.0.1"; $GLOBALS["wallet_port"] = "8332"; $GLOBALS["wallet_user"] = "usrename"; $GLOBALS["wallet_pass"] = "password"; /****************************************************************************** Block Chain And Network Information These functions return general information about the block chain, the wallet itself, and the network the wallet/node is attached to. ******************************************************************************/ function getblock ($block_hash) { // The JSON-RPC request starts with a method name $request_array["method"] = "getblock"; // For getblock a block hash is required $request_array["params"][0] = $block_hash; // Send the request to the wallet $info = wallet_fetch ($request_array); // This function returns an array containing the block // data for the specified block hash return ($info); } function getblockhash ($block_index) { // The JSON-RPC request starts with a method name $request_array["method"] = "getblockhash"; // For getblockhash a block index is required $request_array["params"][0] = $block_index; // Send the request to the wallet $info = wallet_fetch ($request_array); // This function returns a string containing the block // hash value for the specified block in the chain return ($info); } function getinfo () { // The JSON-RPC request starts with a method name $request_array["method"] = "getinfo"; // getinfo has no parameters // Send the request to the wallet $info = wallet_fetch ($request_array); // This function returns an array containing information // about the wallet's network and block chain return ($info); } function getnetworkhashps ($block_index=NULL) { // The JSON-RPC request starts with a method name $request_array["method"] = "getnetworkhashps"; // block index is an optional parameter. If no block // index is specified you get the network hashrate for // the latest block if (isset ($block_index)) { $request_array["params"][0] = $block_index; } // Send the request to the wallet $info = wallet_fetch ($request_array); // This function returns a string containing the calculated // network hash rate for the latest block return ($info); } function getrawtransaction ($tx_id, $verbose=1) { // The JSON-RPC request starts with a method name $request_array["method"] = "getrawtransaction"; // For getrawtransaction a txid is required $request_array["params"][0] = $tx_id; $request_array["params"][1] = $verbose; // Send the request to the wallet $info = wallet_fetch ($request_array); // This function returns a string containing the block // hash value for the specified block in the chain return ($info); } /****************************************************************************** JSON-RPC Fetch This function is used to request information form the daemon. ******************************************************************************/ function wallet_fetch ($request_array) { // Encode the request as JSON for the wallet $request = json_encode ($request_array); // Create curl connection object $coind = curl_init(); // Set the IP address and port for the wallet server curl_setopt ($coind, CURLOPT_URL, $GLOBALS["wallet_ip"]); curl_setopt ($coind, CURLOPT_PORT, $GLOBALS["wallet_port"]); // Tell curl to use basic HTTP authentication curl_setopt($coind, CURLOPT_HTTPAUTH, CURLAUTH_BASIC) ; // Provide the username and password for the connection curl_setopt($coind, CURLOPT_USERPWD, $GLOBALS["wallet_user"].":".$GLOBALS["wallet_pass"]); // JSON-RPC Header for the wallet curl_setopt($coind, CURLOPT_HTTPHEADER, array ("Content-type: application/json")); // Prepare curl for a POST request curl_setopt($coind, CURLOPT_POST, TRUE); // Provide the JSON data for the request curl_setopt($coind, CURLOPT_POSTFIELDS, $request); // Indicate we want the response as a string curl_setopt($coind, CURLOPT_RETURNTRANSFER, TRUE); // Required by RPCSSL self-signed cert curl_setopt($coind, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($coind, CURLOPT_SSL_VERIFYHOST, FALSE); // execute the request $response_data = curl_exec($coind); // Close the connection curl_close($coind); // The JSON response is read into an array $info = json_decode ($response_data, TRUE); // If an error message was received the message is returned // to the calling code as a string. if (isset ($info["error"]) || $info["error"] != "") { return $info["error"]["message"]."(Error Code: ".$info["error"]["code"].")"; } // If there was no error the result is returned to the calling code else { return $info["result"]; } } /****************************************************************************** This script is Copyright � 2013 Jake Paysnoe. I hereby release this script into the public domain. Jake Paysnoe Jun 26, 2013 ******************************************************************************/ ?>

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.0100.00716.63
8.3.50.0100.01022.05
8.3.40.0120.00918.77
8.3.30.0070.00719.09
8.3.20.0070.00020.38
8.3.10.0000.00823.56
8.3.00.0060.00319.13
8.2.180.0070.01418.16
8.2.170.0070.00718.96
8.2.160.0140.00020.57
8.2.150.0050.00324.18
8.2.140.0110.00424.66
8.2.130.0040.00426.16
8.2.120.0080.00022.25
8.2.110.0060.00622.12
8.2.100.0090.00317.78
8.2.90.0080.00017.77
8.2.80.0030.00617.97
8.2.70.0040.00417.63
8.2.60.0060.00317.93
8.2.50.0030.00618.07
8.2.40.0040.00418.34
8.2.30.0040.00418.03
8.2.20.0040.00417.71
8.2.10.0080.00018.11
8.2.00.0060.00317.72
8.1.280.0070.01425.92
8.1.270.0040.00422.13
8.1.260.0000.00826.35
8.1.250.0000.00828.09
8.1.240.0000.01120.73
8.1.230.0040.00820.98
8.1.220.0040.00417.74
8.1.210.0040.00418.86
8.1.200.0000.00817.35
8.1.190.0080.00017.53
8.1.180.0040.00418.10
8.1.170.0040.00418.59
8.1.160.0000.00721.96
8.1.150.0040.00418.63
8.1.140.0070.00017.49
8.1.130.0030.00617.80
8.1.120.0000.00717.52
8.1.110.0060.00317.53
8.1.100.0050.00317.54
8.1.90.0050.00217.46
8.1.80.0040.00417.54
8.1.70.0000.00717.39
8.1.60.0030.00517.54
8.1.50.0000.00817.61
8.1.40.0000.00817.47
8.1.30.0040.00417.56
8.1.20.0040.00417.55
8.1.10.0000.00817.34
8.1.00.0030.00517.46
8.0.300.0030.00519.76
8.0.290.0070.00017.16
8.0.280.0000.00818.42
8.0.270.0000.00717.23
8.0.260.0000.00617.23
8.0.250.0030.00316.96
8.0.240.0070.00016.90
8.0.230.0070.00016.96
8.0.220.0000.00816.94
8.0.210.0000.00716.78
8.0.200.0070.00016.95
8.0.190.0000.00716.94
8.0.180.0070.00016.88
8.0.170.0000.00816.80
8.0.160.0030.00616.70
8.0.150.0040.00416.77
8.0.140.0000.00816.73
8.0.130.0050.00013.31
8.0.120.0000.00716.87
8.0.110.0030.00316.70
8.0.100.0040.00416.86
8.0.90.0040.00416.71
8.0.80.0060.00916.93
8.0.70.0000.00716.70
8.0.60.0000.00816.94
8.0.50.0070.00016.67
8.0.30.0170.00317.30
8.0.20.0100.01017.42
8.0.10.0040.00417.10
8.0.00.0110.00916.74
7.4.330.0000.00515.13
7.4.320.0000.00716.70
7.4.300.0040.00416.47
7.4.290.0000.00716.66
7.4.280.0000.00716.50
7.4.270.0040.00416.65
7.4.260.0070.00016.64
7.4.250.0000.00716.54
7.4.240.0020.00516.54
7.4.230.0060.00016.49
7.4.220.0070.01316.52
7.4.210.0080.00716.60
7.4.200.0040.00416.46
7.4.190.0030.00516.74
7.4.160.0090.00616.57
7.4.150.0140.00417.40
7.4.140.0050.01217.86
7.4.130.0080.00916.60
7.4.120.0130.00316.56
7.4.110.0210.00016.60
7.4.100.0090.00916.60
7.4.90.0070.01116.49
7.4.80.0120.01219.39
7.4.70.0070.01116.43
7.4.60.0030.01316.47
7.4.50.0030.00516.41
7.4.40.0100.00522.77
7.4.30.0160.00316.60
7.4.00.0030.01015.18
7.3.330.0000.00713.13
7.3.320.0000.00513.23
7.3.310.0030.00316.17
7.3.300.0040.00416.28
7.3.290.0110.00316.27
7.3.280.0080.01016.28
7.3.270.0070.01117.40
7.3.260.0120.00616.52
7.3.250.0080.01016.49
7.3.240.0160.00716.58
7.3.230.0110.00616.39
7.3.210.0170.00016.27
7.3.200.0060.01319.39
7.3.190.0100.01116.40
7.3.180.0100.00716.64
7.3.170.0060.01316.63
7.3.160.0090.01116.59
7.3.120.0120.00314.80
7.2.330.0080.00816.74
7.2.320.0090.01216.52
7.2.310.0070.01016.70
7.2.300.0090.00816.73
7.2.290.0210.00316.75
7.1.70.0050.00517.13
7.1.60.0140.01019.33
7.1.50.0060.01316.93
7.1.00.0030.07322.43
7.0.200.0190.00014.69
7.0.140.0070.06722.00
7.0.90.0030.05020.07
7.0.80.0070.04020.04
7.0.70.0030.04319.97
7.0.60.0070.04020.01
7.0.50.0100.03020.36
7.0.40.0000.07319.95
7.0.30.0030.07020.13
7.0.20.0070.07720.07
7.0.10.0170.07720.12
7.0.00.0030.08320.12
5.6.280.0000.07721.13
5.6.230.0070.04320.66
5.6.220.0000.04320.61
5.6.210.0070.03720.59
5.6.200.0100.06021.09
5.6.190.0100.03721.00
5.6.180.0030.08021.14
5.6.170.0170.07021.12
5.6.160.0030.06721.10
5.6.150.0030.08721.09
5.6.140.0000.08721.09
5.6.130.0070.08021.13
5.6.120.0070.08321.00
5.6.110.0100.08321.10
5.6.100.0130.07721.19
5.6.90.0070.08021.14
5.6.80.0000.04720.37
5.6.70.0170.07320.52
5.6.60.0130.08020.43
5.6.50.0070.08320.44
5.6.40.0100.08020.36
5.6.30.0070.06720.48
5.6.20.0070.08320.44
5.6.10.0200.06320.37
5.6.00.0100.07020.45
5.5.370.0070.03320.43
5.5.360.0100.05320.34
5.5.350.0030.04720.46
5.5.340.0100.03720.96
5.5.330.0000.04720.68
5.5.320.0070.07720.77
5.5.310.0170.08020.95
5.5.300.0170.07020.91
5.5.290.0030.07020.65
5.5.280.0070.08020.83
5.5.270.0070.05720.94
5.5.260.0130.05720.91
5.5.250.0030.09020.73
5.5.240.0030.06320.15
5.5.230.0030.08320.18
5.5.220.0100.07720.28
5.5.210.0100.07720.33
5.5.200.0070.04720.19
5.5.190.0130.07020.30
5.5.180.0030.08020.18
5.5.160.0030.08320.01
5.5.150.0000.05020.28
5.5.140.0130.07720.25
5.5.130.0130.04020.21
5.5.120.0070.07020.18
5.5.110.0030.08020.19
5.5.100.0130.08020.20
5.5.90.0130.07320.00
5.5.80.0070.06020.13
5.5.70.0070.04720.20
5.5.60.0130.05319.96
5.5.50.0130.08020.06
5.5.40.0100.07720.09
5.5.30.0070.07719.99
5.5.20.0030.08320.13
5.5.10.0070.04720.08
5.5.00.0130.05320.08
5.4.450.0000.06319.21
5.4.440.0070.07319.49
5.4.430.0070.08019.44
5.4.420.0070.08319.45
5.4.410.0030.08319.22
5.4.400.0100.06319.19
5.4.390.0070.07319.09
5.4.380.0130.08019.18
5.4.370.0170.06718.85
5.4.360.0070.04318.84
5.4.350.0070.08019.05
5.4.340.0200.07019.16
5.4.320.0100.03719.03
5.4.310.0130.06319.16
5.4.300.0070.06318.87
5.4.290.0000.08719.04
5.4.280.0170.05719.14
5.4.270.0200.06319.13
5.4.260.0300.04719.02
5.4.250.0100.08019.12
5.4.240.0070.04719.14
5.4.230.0070.06319.16
5.4.220.0030.07718.94
5.4.210.0070.06719.02
5.4.200.0030.07718.84
5.4.190.0230.06319.15
5.4.180.0100.04719.13
5.4.170.0000.08319.02
5.4.160.0070.07319.21
5.4.150.0070.05018.86
5.4.140.0000.05716.26
5.4.130.0130.03716.49
5.4.120.0170.04716.40
5.4.110.0100.07016.49
5.4.100.0130.05716.52
5.4.90.0000.06316.38
5.4.80.0000.04316.43
5.4.70.0000.04716.48
5.4.60.0070.04016.42
5.4.50.0070.04316.42
5.4.40.0000.04316.42
5.4.30.0030.04316.34
5.4.20.0030.04716.31
5.4.10.0070.05016.45
5.4.00.0070.04315.83
5.3.290.0130.07014.71
5.3.280.0030.07014.71
5.3.270.0070.05714.75
5.3.260.0130.07714.56
5.3.250.0130.06714.74
5.3.240.0100.05014.66
5.3.230.0130.06714.54
5.3.220.0030.08314.61
5.3.210.0000.08014.65
5.3.200.0000.08714.65
5.3.190.0100.06714.71
5.3.180.0070.05014.65
5.3.170.0100.07714.52
5.3.160.0070.03714.71
5.3.150.0000.08014.59
5.3.140.0100.07014.64
5.3.130.0030.04014.52
5.3.120.0100.07314.55
5.3.110.0070.07714.50
5.3.100.0070.06714.16
5.3.90.0100.07713.96
5.3.80.0100.05713.96
5.3.70.0130.05714.02
5.3.60.0030.05314.15
5.3.50.0000.05014.08
5.3.40.0100.07014.11
5.3.30.0070.06013.92
5.3.20.0030.04713.78
5.3.10.0170.05713.60
5.3.00.0130.05713.58
5.2.170.0030.06711.28
5.2.160.0130.05711.06
5.2.150.0070.06711.23
5.2.140.0030.06011.09
5.2.130.0130.06011.19
5.2.120.0000.06711.24
5.2.110.0030.07011.06
5.2.100.0030.06311.23
5.2.90.0030.04311.23
5.2.80.0100.06311.11
5.2.70.0030.05311.24
5.2.60.0100.03011.09
5.2.50.0070.06011.06
5.2.40.0030.04311.14
5.2.30.0000.03311.03
5.2.20.0130.04311.05
5.2.10.0070.06010.82
5.2.00.0030.06310.57
5.1.60.0070.04010.12
5.1.50.0000.0609.87
5.1.40.0070.0539.86
5.1.30.0100.05010.43
5.1.20.0030.05010.25
5.1.10.0070.04010.12
5.1.00.0030.0439.95
5.0.50.0030.0438.42
5.0.40.0000.0508.54
5.0.30.0030.0638.33
5.0.20.0030.0278.23
5.0.10.0030.0438.32
5.0.00.0070.0608.09
4.4.90.0030.0337.27
4.4.80.0100.0137.27
4.4.70.0000.0337.27
4.4.60.0030.0337.27
4.4.50.0130.0177.27
4.4.40.0070.0307.27
4.4.30.0030.0337.27
4.4.20.0070.0177.27
4.4.10.0000.0207.27
4.4.00.0100.0477.27
4.3.110.0100.0307.27
4.3.100.0100.0277.27
4.3.90.0070.0337.27
4.3.80.0000.0377.27
4.3.70.0070.0277.27
4.3.60.0030.0377.27
4.3.50.0000.0377.27
4.3.40.0000.0437.27
4.3.30.0000.0237.27
4.3.20.0000.0377.27
4.3.10.0030.0337.27
4.3.00.0000.0307.27

preferences:
45.96 ms | 401 KiB | 5 Q