3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); function & XMLRPC_adjustValue(&$current_node){ if(is_array($current_node)){ if(isset($current_node['array'])){ if(!is_array($current_node['array']['data'])){ #If there are no elements, return an empty array return array(); }else{ #echo "Getting rid of array -> data -> value<br>\n"; $temp = &$current_node['array']['data']['value']; if(is_array($temp) and array_key_exists(0, $temp)){ $count = count($temp); for($n=0;$n<$count;$n++){ $temp2[$n] = &XMLRPC_adjustValue($temp[$n]); } $temp = &$temp2; }else{ $temp2 = &XMLRPC_adjustValue($temp); $temp = array(&$temp2); #I do the temp assignment because it avoids copying, # since I can put a reference in the array #PHP's reference model is a bit silly, and I can't just say: # $temp = array(&XMLRPC_adjustValue(&$temp)); } } }elseif(isset($current_node['struct'])){ if(!is_array($current_node['struct'])){ #If there are no members, return an empty array return array(); }else{ #echo "Getting rid of struct -> member<br>\n"; $temp = &$current_node['struct']['member']; if(is_array($temp) and array_key_exists(0, $temp)){ $count = count($temp); for($n=0;$n<$count;$n++){ #echo "Passing name {$temp[$n][name]}. Value is: " . show($temp[$n][value], var_dump, true) . "<br>\n"; $temp2[$temp[$n]['name']] = &XMLRPC_adjustValue($temp[$n]['value']); #echo "adjustValue(): After assigning, the value is " . show($temp2[$temp[$n]['name']], var_dump, true) . "<br>\n"; } }else{ #echo "Passing name $temp[name]<br>\n"; $temp2[$temp['name']] = &XMLRPC_adjustValue($temp['value']); } $temp = &$temp2; } }else{ $types = array('string', 'int', 'i4', 'double', 'dateTime.iso8601', 'base64', 'boolean'); $fell_through = true; foreach($types as $type){ if(array_key_exists($type, $current_node)){ #echo "Getting rid of '$type'<br>\n"; $temp = &$current_node[$type]; #echo "adjustValue(): The current node is set with a type of $type<br>\n"; $fell_through = false; break; } } if($fell_through){ $type = 'string'; #echo "Fell through! Type is $type<br>\n"; } switch ($type){ case 'int': case 'i4': $temp = (int)$temp; break; case 'string': $temp = (string)$temp; break; case 'double': $temp = (double)$temp; break; case 'boolean': $temp = (bool)$temp; break; } } }else{ $temp = (string)$current_node; } return $temp; } function XMLRPC_getParams($request){ if(!is_array($request['methodCall']['params'])){ #If there are no parameters, return an empty array return array(); }else{ #echo "Getting rid of methodCall -> params -> param<br>\n"; $temp = &$request['methodCall']['params']['param']; if(is_array($temp) and array_key_exists(0, $temp)){ $count = count($temp); for($n = 0; $n < $count; $n++){ #echo "Serializing parameter $n<br>"; $temp2[$n] = &XMLRPC_adjustValue($temp[$n]['value']); } }else{ $temp2[0] = &XMLRPC_adjustValue($temp['value']); } $temp = &$temp2; return $temp; } } function XMLRPC_getMethodName($methodCall){ #returns the method name return $methodCall['methodCall']['methodName']; } function XMLRPC_request($site, $location, $methodName, $params = NULL, $user_agent = NULL){ $site = explode(':', $site); if(isset($site[1]) and is_numeric($site[1])){ $port = $site[1]; }else{ $port = 80; } $site = $site[0]; $data["methodCall"]["methodName"] = $methodName; $param_count = count($params); if(!$param_count){ $data["methodCall"]["params"] = NULL; }else{ for($n = 0; $n<$param_count; $n++){ $data["methodCall"]["params"]["param"][$n]["value"] = $params[$n]; } } $data = XML_serialize($data); if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){ XMLRPC_debug('XMLRPC_request', "<p>Received the following parameter list to send:</p>" . XMLRPC_show($params, 'print_r', true)); } $conn = fsockopen ($site, $port); #open the connection if(!$conn){ #if the connection was not opened successfully if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){ XMLRPC_debug('XMLRPC_request', "<p>Connection failed: Couldn't make the connection to $site.</p>"); } return array(false, array('faultCode'=>10532, 'faultString'=>"Connection failed: Couldn't make the connection to $site.")); }else{ $headers = "POST $location HTTP/1.0\r\n" . "Host: $site\r\n" . "Connection: close\r\n" . ($user_agent ? "User-Agent: $user_agent\r\n" : '') . "Content-Type: text/xml\r\n" . "Content-Length: " . strlen($data) . "\r\n\r\n"; fputs($conn, "$headers"); fputs($conn, $data); if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){ XMLRPC_debug('XMLRPC_request', "<p>Sent the following request:</p>\n\n" . XMLRPC_show($headers . $data, 'print_r', true)); } #socket_set_blocking ($conn, false); $response = ""; while(!feof($conn)){ $response .= fgets($conn, 1024); } fclose($conn); #strip headers off of response $data = XML_unserialize(substr($response, strpos($response, "\r\n\r\n")+4)); if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){ XMLRPC_debug('XMLRPC_request', "<p>Received the following response:</p>\n\n" . XMLRPC_show($response, 'print_r', true) . "<p>Which was serialized into the following data:</p>\n\n" . XMLRPC_show($data, 'print_r', true)); } if(isset($data['methodResponse']['fault'])){ $return = array(false, XMLRPC_adjustValue($data['methodResponse']['fault']['value'])); if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){ XMLRPC_debug('XMLRPC_request', "<p>Returning:</p>\n\n" . XMLRPC_show($return, 'var_dump', true)); } return $return; }else{ $return = array(true, XMLRPC_adjustValue($data['methodResponse']['params']['param']['value'])); if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){ XMLRPC_debug('XMLRPC_request', "<p>Returning:</p>\n\n" . XMLRPC_show($return, 'var_dump', true)); } return $return; } } }

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.01118.31
8.3.50.0170.00320.07
8.3.40.0070.01118.87
8.3.30.0070.00719.13
8.3.20.0040.00420.27
8.3.10.0000.00823.52
8.3.00.0060.00319.13
8.2.180.0060.01516.50
8.2.170.0140.00722.96
8.2.160.0120.00320.29
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0080.00026.16
8.2.120.0050.00321.04
8.2.110.0030.00622.15
8.2.100.0040.00718.22
8.2.90.0060.00319.21
8.2.80.0040.00417.97
8.2.70.0080.00017.38
8.2.60.0000.00817.80
8.2.50.0000.01118.07
8.2.40.0000.00819.82
8.2.30.0030.00619.58
8.2.20.0000.00817.57
8.2.10.0000.00717.98
8.2.00.0000.00817.57
8.1.280.0140.00725.92
8.1.270.0080.00023.96
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0060.00323.88
8.1.230.0040.00819.28
8.1.220.0080.00017.74
8.1.210.0040.00418.77
8.1.200.0040.00817.13
8.1.190.0060.00317.36
8.1.180.0030.00618.10
8.1.170.0030.00618.61
8.1.160.0060.00322.03
8.1.150.0000.00818.89
8.1.140.0050.00217.45
8.1.130.0030.00517.81
8.1.120.0040.00417.49
8.1.110.0050.00317.43
8.1.100.0000.00717.38
8.1.90.0000.00717.44
8.1.80.0040.00417.34
8.1.70.0000.00717.34
8.1.60.0040.00417.52
8.1.50.0000.00817.54
8.1.40.0050.00317.50
8.1.30.0000.00817.48
8.1.20.0050.00317.70
8.1.10.0000.00817.52
8.1.00.0060.00317.39
8.0.300.0070.00018.77
8.0.290.0050.00316.75
8.0.280.0020.00518.36
8.0.270.0030.00317.14
8.0.260.0000.00717.16
8.0.250.0070.00016.96
8.0.240.0070.00016.84
8.0.230.0040.00416.85
8.0.220.0060.00316.87
8.0.210.0030.00316.90
8.0.200.0030.00316.87
8.0.190.0050.00316.91
8.0.180.0070.00016.93
8.0.170.0080.00016.84
8.0.160.0030.00516.92
8.0.150.0030.00316.80
8.0.140.0040.00416.82
8.0.130.0000.00613.34
8.0.120.0030.00616.87
8.0.110.0000.00716.74
8.0.100.0070.00016.91
8.0.90.0000.00716.84
8.0.80.0090.00616.77
8.0.70.0030.00516.71
8.0.60.0080.00016.86
8.0.50.0080.00017.00
8.0.30.0100.01317.04
8.0.20.0110.00917.40
8.0.10.0000.00716.82
8.0.00.0130.00616.69
7.4.330.0030.00315.03
7.4.320.0060.00016.41
7.4.300.0030.00316.48
7.4.290.0040.00416.52
7.4.280.0080.00016.59
7.4.270.0050.00316.60
7.4.260.0090.00016.56
7.4.250.0040.00416.41
7.4.240.0020.00516.46
7.4.230.0030.00316.66
7.4.220.0110.00816.56
7.4.210.0110.01116.57
7.4.200.0030.00316.40
7.4.160.0070.01116.61
7.4.150.0130.00617.40
7.4.140.0120.00917.86
7.4.130.0070.01216.56
7.4.120.0120.00516.59
7.4.110.0180.00016.34
7.4.100.0110.00716.54
7.4.90.0040.01516.34
7.4.80.0140.01119.39
7.4.70.0070.01016.39
7.4.60.0100.00716.52
7.4.50.0040.00416.32
7.4.40.0060.01116.53
7.4.30.0030.01416.57
7.4.00.0060.00915.02
7.3.330.0000.00513.33
7.3.320.0000.00513.27
7.3.310.0070.00016.29
7.3.300.0040.00416.17
7.3.290.0030.01716.24
7.3.280.0140.00316.31
7.3.270.0130.00717.40
7.3.260.0190.00616.56
7.3.250.0090.01016.51
7.3.240.0030.01416.54
7.3.230.0030.01416.56
7.3.210.0060.01116.56
7.3.200.0070.01019.39
7.3.190.0110.00616.34
7.3.180.0060.01016.27
7.3.170.0060.00916.27
7.3.160.0030.01316.49
7.3.120.0030.01714.90
7.3.110.0080.00814.94
7.3.100.0000.01514.62
7.3.90.0100.00715.07
7.3.80.0070.00714.86
7.3.70.0090.00414.75
7.3.60.0030.01214.82
7.3.50.0070.00714.63
7.3.40.0130.00314.77
7.3.30.0040.00814.76
7.3.20.0030.01016.47
7.3.10.0040.01116.56
7.3.00.0070.00716.35
7.2.330.0090.00916.71
7.2.320.0140.00316.32
7.2.310.0090.01016.62
7.2.300.0060.01516.73
7.2.290.0070.01016.49
7.2.250.0100.00714.85
7.2.240.0070.01314.82
7.2.230.0040.01114.96
7.2.220.0050.00814.99
7.2.210.0030.01015.04
7.2.200.0030.01215.16
7.2.190.0070.00715.06
7.2.180.0030.01415.03
7.2.170.0150.00015.02
7.2.00.0070.00719.33
7.1.330.0070.00715.53
7.1.320.0060.00615.87
7.1.310.0110.00715.67
7.1.300.0090.00015.72
7.1.290.0100.00615.62
7.1.280.0000.00915.62
7.1.270.0080.00415.65
7.1.260.0090.00415.42
7.1.100.0040.00818.05
7.1.70.0090.00616.75
7.1.60.0090.01519.46
7.1.50.0070.01016.54
7.1.00.0070.07322.42
7.0.200.0000.00816.64
7.0.140.0070.06721.92
7.0.100.0130.06720.05
7.0.90.0070.08020.13
7.0.80.0070.04020.01
7.0.70.0070.06720.04
7.0.60.0070.06720.07
7.0.50.0100.04720.50
7.0.40.0100.04719.95
7.0.30.0100.07320.18
7.0.20.0100.07020.11
7.0.10.0070.05320.04
7.0.00.0130.07320.12
5.6.280.0070.07021.11
5.6.250.0170.07320.79
5.6.240.0070.06320.61
5.6.230.0070.08320.63
5.6.220.0070.07720.66
5.6.210.0130.06720.68
5.6.200.0030.08321.07
5.6.190.0100.05720.99
5.6.180.0170.06721.07
5.6.170.0100.07321.09
5.6.160.0100.08321.10
5.6.150.0030.07021.05
5.6.140.0200.06321.08
5.6.130.0030.09321.00
5.6.120.0130.08320.97
5.6.110.0070.07021.14
5.6.100.0130.07320.98
5.6.90.0130.06721.06
5.6.80.0070.06320.45
5.6.70.0070.08020.55
5.6.60.0130.07320.35
5.6.50.0130.07320.43
5.6.40.0030.06320.35
5.6.30.0030.07320.37
5.6.20.0070.06320.36
5.6.10.0170.05720.40
5.6.00.0030.07020.47
5.5.380.0030.05020.39
5.5.370.0000.06020.54
5.5.360.0070.04720.43
5.5.350.0030.07320.48
5.5.340.0200.06020.67
5.5.330.0130.07720.78
5.5.320.0100.07720.96
5.5.310.0030.08720.93
5.5.300.0100.07320.85
5.5.290.0000.07320.93
5.5.280.0200.05020.87
5.5.270.0170.07320.76
5.5.260.0130.03320.89
5.5.250.0230.06320.59
5.5.240.0030.05320.19
5.5.230.0070.08320.35
5.5.220.0030.04020.30
5.5.210.0030.08020.30
5.5.200.0100.06720.32
5.5.190.0130.06320.31
5.5.180.0100.07720.10
5.5.160.0030.06720.23
5.5.150.0030.03320.25
5.5.140.0130.07320.19
5.5.130.0100.06720.31
5.5.120.0100.07020.02
5.5.110.0070.06720.20
5.5.100.0030.08320.10
5.5.90.0070.06320.02
5.5.80.0070.03720.11
5.5.70.0130.07020.13
5.5.60.0000.05320.13
5.5.50.0070.07320.10
5.5.40.0030.07720.10
5.5.30.0100.07720.15
5.5.20.0130.07320.14
5.5.10.0130.06320.06
5.5.00.0130.07720.13
5.4.450.0030.07019.36
5.4.440.0100.06319.36
5.4.430.0000.05019.43
5.4.420.0130.07319.37
5.4.410.0100.06319.09
5.4.400.0130.06719.05
5.4.390.0070.05019.04
5.4.380.0000.04718.93
5.4.370.0070.06319.18
5.4.360.0070.07318.86
5.4.350.0030.06719.14
5.4.340.0070.06319.19
5.4.320.0070.07318.88
5.4.310.0100.03318.86
5.4.300.0030.05019.13
5.4.290.0000.05719.14
5.4.280.0170.07019.23
5.4.270.0030.04018.88
5.4.260.0070.07319.21
5.4.250.0070.06719.02
5.4.240.0130.07719.14
5.4.230.0000.07319.04
5.4.220.0070.05319.04
5.4.210.0200.06319.20
5.4.200.0000.08319.22
5.4.190.0100.07719.13
5.4.180.0070.08019.04
5.4.170.0070.06719.13
5.4.160.0200.06719.19
5.4.150.0100.07319.17
5.4.140.0100.07016.43
5.4.130.0000.07716.50
5.4.120.0100.06316.39
5.4.110.0030.07716.48
5.4.100.0030.07316.53
5.4.90.0000.06716.39
5.4.80.0130.06716.56
5.4.70.0170.06016.37
5.4.60.0000.05316.43
5.4.50.0100.06716.49
5.4.40.0070.05316.50
5.4.30.0000.06316.44
5.4.20.0100.06316.40
5.4.10.0100.07316.50
5.4.00.0070.05315.66

preferences:
50.33 ms | 400 KiB | 5 Q