3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (!isset($_SESSION)) { session_start(); } function dumpDOMnodeList($xml) { $docTmp = new DOMDocument(); foreach($xml as $n) $docTmp->appendChild($docTmp->importNode($n,true)); //echo '<pre>'; print_r($docTmp->saveHTML()); //echo '</pre>'; } class ipm { //BEGIN VARIABLES public $soapVersion; public $soapLocation; public $soapContext; public $soapParameters; public $soapClient; public $soapCookies; public $soapService; const groupID = '104362395629'; //MAIN GROUP NUMBER WITHIN IPM, NEVER CHANGES //END VARIABLES //BEGIN CONSTRUCTOR function __construct($soapService) { $this->soapService = $soapService; //STATUS OR CONFIG $this->soapVersion = '1.2'; $this->soapLocation = 'https://webservice.domain/soap/'.$this->soapService.'.asmx'; $this->soapContext = stream_context_create(array('ssl' => array('verify_peer' => TRUE))); $this->soapParameters = array ( 'location' => $this->soapLocation, 'login' => 'user', 'password' => 'password', 'stream_context' => $this->soapContext, 'trace' => 1, 'keep_alive' => 1, 'cache_wsdl' => WSDL_CACHE_NONE ); $this->soapClient = new SoapClient('./'.$this->soapService.'.wsdl',$this->soapParameters); } //END CONSTRUCTOR //BEGIN PRIVATE FUNCTIONS private function schemaOpen($fn='',$vars) { $tmp = '<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'; if(empty($vars)) { return $tmp.'<soap:Body><'.$fn.' xmlns="'.$this->schemaBase().'" />'; } else { return $tmp.'<soap:Body><'.$fn.' xmlns="'.$this->schemaBase().'">'; } } private function schemaClose($fn='',$vars) { if(empty($vars)) { return '</soap:Body></soap:Envelope>'; } else { return '</'.$fn.'></soap:Body></soap:Envelope>'; } } private function schemaBase($fn='') { return 'http://schemas.ipmonitor.com/ipm70/'.$fn; } private function dumpDOMnodeList($xml) { $docTmp = new DOMDocument(); foreach($xml as $n) $docTmp->appendChild($docTmp->importNode($n,true)); echo '<pre>'; print_r(htmlentities($docTmp->saveHTML())); echo '</pre>'; } private function debugSoap() { echo '<pre>'; echo $this->soapClient->__getLastRequestHeaders(); echo $this->soapClient->__getLastRequest(); echo $this->soapClient->__getLastResponseHeaders(); echo '</pre>'; } private function soapRequest($fn='',$vars=array()) { $xml=$this->schemaOpen($fn,$vars); foreach($vars as $key=>$val) { $xml .= '<'.$key.'>'.$val.'</'.$key.'>'; } $xml.=$this->schemaClose($fn,$vars); return $xml; } private function callMethod($fn,$vars=array()) { $soapRequest = $this->soapRequest($fn,$vars); $soapAction = $this->schemaBase($fn); $soapResponse = $this->soapClient->__doRequest($soapRequest, $this->soapLocation, $soapAction, $this->soapVersion,0); $this->logSoap($soapRequest, $this->soapLocation, $soapAction, $this->soapVersion, $soapResponse,$this->debugSoap()); return $soapResponse; } private function logSoap($request, $location, $action, $version, $reponse, $debug) { file_put_contents('soap_log', date('m-d-Y H:i:s')."\r\nRequest: $request\r\n\r\nLocation: $location\r\nAction: $action\r\nVersion: $version\r\nResponse: $response\r\nDebug: $debug\r\n\r\n"); } //END PRIVATE FUNCTIONS //BEGIN METHODS public function GetGroup($rtGroupID) { /* GetGroup returns the status and some minor details about a specific Monitor. */ return $this->callMethod(__FUNCTION__,array('id'=>$rtGroupID)); } public function GetGroups() { /* GetGroups returns the status of members and depends of a specific Group */ return $this->callMethod(__FUNCTION__,array()); } public function GetMonitors($rtGroupID) { /* GetMonitor returns the status of the members and depends of a specific Group. */ return $this->callMethod(__FUNCTION__,array('groupid'=>$rtGroupID,'bTroubleOnly'=>'TRUE')); } public function GetMonitor($rtMonitorID) { /* GetMonitor returns the status and some minor details about a specific Monitor. */ return $this->callMethod(__FUNCTION__,array('id'=>$rtMonitorID)); } public function MonitorView($rtMonitorID) { /* MonitorView retrieves an ipMonitor 7 Monitor objects's settings in xml format. */ return $this->callMethod(__FUNCTION__,array('mon_id'=>$rtMonitorID)); } public function GroupList() { /* GroupList retrieves the ID's of all the existing Group objects. */ return $this->callMethod(__FUNCTION__,array()); } public function GroupView($rtGroupID) { /* GroupView retrieves an ipMonitor 7 Group objects's settings in xml format. */ return $this->callMethod(__FUNCTION__,array('groupid'=>$rtGroupID)); } //END METHODS } /* BEGIN GET ALL DOWN MONITORS */ $ipm = new ipm('status'); $ipmGroups = $ipm->GetGroups(); if(!empty($ipmGroups)) { $doc = new DOMDocument(); $doc->LoadXML($ipmGroups); $xpath = new DOMXpath($doc); $xpath->registerNamespace('soap', 'http://schemas.xmlsoap.org/soap/envelope/'); $xpath->registerNamespace('def', 'http://schemas.ipmonitor.com/ipm70/'); $ipmGroupsAlarming = $xpath->query("/soap:Envelope/soap:Body/def:GetGroupsResponse/def:GetGroupsResult/def:rtGroup[(contains(def:status,'lost') or contains(def:status,'warn') or contains(def:status,'down')) and contains(def:isroot,'false')]"); $numGroupsAlarming = $ipmGroupsAlarming->length; if($numGroupsAlarming === 0) { echo '<div class="text-success">No issues</div>'."\r\n"; } else { unset($ipm,$ipmGroups,$doc,$xpath,$numGroupsAlarming); foreach($ipmGroupsAlarming as $ipmGroupAlarming) { $groupName = $ipmGroupAlarming->getElementsByTagName('name')->item(0)->nodeValue; $groupStatus = $ipmGroupAlarming->getElementsByTagName('status')->item(0)->nodeValue; $groupID = $ipmGroupAlarming->getElementsByTagName('id')->item(0)->nodeValue; echo $groupName.'<br/>'."\r\n"; $ipm = new ipm('status'); $ipmMonitors= $ipm->GetMonitors($groupID); $doc = new DOMDocument(); $doc->LoadXML($ipmMonitors); $xpath = new DOMXpath($doc); $xpath->registerNamespace('soap', 'http://schemas.xmlsoap.org/soap/envelope/'); $xpath->registerNamespace('def', 'http://schemas.ipmonitor.com/ipm70/'); $ipmMonitorsAlarming = $xpath->query("/soap:Envelope/soap:Body/def:GetMonitorsResponse/def:GetMonitorsResult/def:rtMonitor"); $numMonitorsAlarming = $ipmMonitorsAlarming->length; if($numMonitorsAlarming === 0) { echo 'No Monitors Down Under This Device<br/>'."\r\n"; } else { foreach($ipmMonitorsAlarming as $ipmMonitorAlarming) { $monitorName = $ipmMonitorAlarming->getElementsByTagName('name')->item(0)->nodeValue; $monitorStatus = $ipmMonitorAlarming->getElementsByTagName('status')->item(0)->nodeValue; $monitorID = $ipmMonitorAlarming->getElementsByTagName('id')->item(0)->nodeValue; echo '--&gt; '.$monitorStatus.' - '.$monitorName.'<br/>'."\r\n"; } } unset($ipm,$ipmMonitors,$doc,$xpath,$numMonitorsAlarming,$ipmMonitorsAlarming); echo '<br/>'; } } } elseif($ipmGroups == NULL) {echo 'NULL SOAP RESPONSE';} else { echo 'No issues'."\r\n"; } /* END GET ALL DOWN MONITORS */ ?>

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.00718.56
8.3.50.0070.01016.66
8.3.40.0130.00619.63
8.3.30.0070.01019.34
8.2.180.0070.01018.39
8.2.170.0150.00425.92
8.1.280.0090.00925.92
7.4.10.0200.01016.57
7.4.00.0100.00715.77
7.3.130.0160.01616.74
7.3.120.0080.01015.54
7.3.110.0090.01415.75
7.3.100.0110.01015.87
7.3.90.0100.00815.82
7.3.80.0140.00715.76
7.3.70.0110.01115.69
7.3.60.0110.01415.77
7.3.50.0120.00815.76
7.3.40.0090.01115.86
7.3.30.0140.00915.75
7.3.20.0150.00817.48
7.3.10.0170.00817.44
7.3.00.0110.01016.52
7.2.260.0140.01416.81
7.2.250.0080.01415.94
7.2.240.0130.01115.87
7.2.230.0140.00815.96
7.2.220.0120.01116.16
7.2.210.0120.01115.98
7.2.200.0150.01115.94
7.2.190.0110.00615.76
7.2.180.0150.01215.76
7.2.170.0100.01615.99
7.2.160.0190.01516.61
7.2.150.0300.00316.94
7.2.140.0170.01318.37
7.2.130.0160.01616.86
7.2.120.0330.01716.68
7.2.110.0590.01316.71
7.2.100.0280.00618.48
7.2.90.0210.01718.43
7.2.80.0140.00813.13
7.2.70.0140.00713.13
7.2.60.0160.00415.16
7.2.50.0160.00713.13
7.2.40.0110.00013.13
7.2.30.0260.01116.80
7.2.20.0150.01816.58
7.2.10.0180.01418.46
7.2.00.0160.00718.13
7.1.330.0110.00916.60
7.1.320.0110.01216.51
7.1.310.0050.01616.43
7.1.300.0120.00514.45
7.1.290.1260.00815.54
7.1.280.0180.00416.66
7.1.270.0210.01016.50
7.1.260.0150.00615.65
7.1.250.0200.01017.47
7.1.240.0560.00715.61
7.1.230.0480.01515.53
7.1.220.0180.01117.34
7.1.210.0170.00713.13
7.1.200.0140.01115.73
7.1.190.0240.00917.21
7.1.180.0100.02315.55
7.1.170.0530.01215.55
7.1.160.0240.00515.52
7.1.150.0240.00317.22
7.1.140.0430.01315.66
7.1.130.0610.01415.59
7.1.120.0210.00715.82
7.1.110.0200.01015.59
7.1.100.0070.01216.87
7.1.90.0500.00715.70
7.1.80.0220.00817.39
7.1.70.0290.00914.95
7.1.60.0140.01318.41
7.1.50.0210.01016.24
7.1.40.0160.00917.21
7.1.30.0180.00915.63
7.1.20.0170.01417.32
7.1.10.0120.01213.13
7.1.00.0160.04019.74
7.0.330.0210.00615.35
7.0.320.0180.00915.46
7.0.310.0490.00513.13
7.0.300.0200.00313.13
7.0.290.0200.01015.30
7.0.280.0130.01717.26
7.0.270.0120.01617.12
7.0.260.0100.02015.43
7.0.250.0240.00317.01
7.0.240.0340.00915.29
7.0.230.0200.00917.03
7.0.220.0240.00615.18
7.0.210.0280.02017.07
7.0.200.0140.00916.18
7.0.190.0120.00613.13
7.0.180.0560.01015.47
7.0.170.0170.01415.39
7.0.160.0260.00315.43
7.0.150.0190.01215.38
7.0.140.0110.04319.47
7.0.130.0650.00715.34
7.0.120.0520.01015.20
7.0.110.0260.00517.08
7.0.100.0430.03317.64
7.0.90.0320.02618.70
7.0.80.0230.04018.48
7.0.70.0550.04517.62
7.0.60.0230.04818.51
7.0.50.0200.03916.71
7.0.40.0090.02916.65
7.0.30.0150.04417.58
7.0.20.0140.04217.52
7.0.10.0160.04317.55
7.0.00.0120.04517.55
5.6.400.0150.00815.79
5.6.390.0170.00613.13
5.6.380.0140.01415.96
5.6.370.0150.01516.08
5.6.360.0160.00816.19
5.6.350.0180.01115.88
5.6.340.0230.01216.38
5.6.330.0190.01515.68
5.6.320.0230.01616.15
5.6.310.0190.00013.13
5.6.300.0200.01015.90
5.6.290.0180.01316.25
5.6.280.0110.04318.52
5.6.270.0240.00616.00
5.6.260.0140.00813.13
5.6.250.0200.04218.30
5.6.240.0120.05018.37
5.6.230.0120.03218.39
5.6.220.0120.04718.34
5.6.210.0120.04418.30
5.6.200.0190.04718.54
5.6.190.0130.04618.57
5.6.180.0210.03018.69
5.6.170.0140.04818.68
5.6.160.0110.03117.08
5.6.150.0060.03618.57
5.6.140.0070.03817.13
5.6.130.0110.03117.10
5.6.120.0130.05018.55
5.6.110.0130.04617.11
5.6.100.0120.04818.45
5.6.90.0110.02417.11
5.6.80.0150.04518.30
5.6.70.0100.04016.81
5.6.60.0110.05416.82
5.6.50.0110.02316.78
5.6.40.0140.04118.21
5.6.30.0110.03818.34
5.6.20.0150.04218.13
5.6.10.0130.03216.84
5.6.00.0140.02618.27
5.5.380.0130.03118.38
5.5.370.0170.04118.23
5.5.360.0160.03516.77
5.5.350.0100.02718.24
5.5.340.0160.04118.50
5.5.330.0160.04418.39
5.5.320.0180.03718.40
5.5.310.0120.04718.45
5.5.300.0120.05118.30
5.5.290.0220.03718.44
5.5.280.0100.04018.26
5.5.270.0150.04618.41
5.5.260.0140.04418.40
5.5.250.0090.04218.29
5.5.240.0070.03318.05
5.5.230.0160.04118.01
5.5.220.0090.04718.10
5.5.210.0160.03718.08
5.5.200.0100.04718.11
5.5.190.0140.02216.71
5.5.180.0090.05518.11
5.5.170.0120.01015.96
5.5.160.0100.02718.09
5.5.150.0170.04018.10
5.5.140.0130.04518.16
5.5.130.0120.04118.08
5.5.120.0120.04018.05
5.5.110.0190.03618.12
5.5.100.0070.04717.96
5.5.90.0140.04318.05
5.5.80.0200.03917.96
5.5.70.0140.04017.99
5.5.60.0180.03417.98
5.5.50.0080.02817.98
5.5.40.0080.04518.06
5.5.30.0210.03217.95
5.5.20.0100.05117.98
5.5.10.0050.04718.02
5.5.00.0110.03918.06
5.4.450.0080.02816.28
5.4.440.0120.04016.25
5.4.430.0130.03516.30
5.4.420.0100.03216.24
5.4.410.0090.04316.14
5.4.400.0040.03016.15
5.4.390.0060.03016.09
5.4.380.0120.03916.09
5.4.370.0120.03316.03
5.4.360.0090.05116.17
5.4.350.0110.04516.08
5.4.340.0150.03316.18
5.4.330.0150.00413.13
5.4.320.0090.04216.13
5.4.310.0050.04716.16
5.4.300.0140.03916.11
5.4.290.0110.03616.08
5.4.280.0080.03816.08
5.4.270.0080.04016.13
5.4.260.0100.03916.13
5.4.250.0100.02516.07
5.4.240.0150.03416.08
5.4.230.0110.04216.17
5.4.220.0070.02616.14
5.4.210.0080.04216.13
5.4.200.0070.03516.08
5.4.190.0110.04116.07
5.4.180.0060.03716.16
5.4.170.0070.04516.12
5.4.160.0120.03916.01
5.4.150.0100.04016.12
5.4.140.0110.04014.76
5.4.130.0140.03614.71
5.4.120.0090.03314.83
5.4.110.0080.04514.79
5.4.100.0070.04014.75
5.4.90.0030.04514.77
5.4.80.0080.03814.75
5.4.70.0090.03814.83
5.4.60.0120.02314.71
5.4.50.0140.03514.81
5.4.40.0090.04414.75
5.4.30.0100.04214.79
5.4.20.0060.04414.74
5.4.10.0110.02314.83
5.4.00.0050.04814.56
5.3.290.0130.03814.11
5.3.280.0030.04914.11
5.3.270.0080.04313.99
5.3.260.0100.02614.21
5.3.250.0090.04314.20
5.3.240.0080.04014.10
5.3.230.0090.04114.10
5.3.220.0120.02913.92
5.3.210.0090.03913.96
5.3.200.0070.04114.01
5.3.190.0070.04613.98
5.3.180.0060.04014.25
5.3.170.0090.02614.12
5.3.160.0110.03714.20
5.3.150.0100.03114.14
5.3.140.0090.04114.17
5.3.130.0080.04314.03
5.3.120.0110.04414.05
5.3.110.0090.04314.15
5.3.100.0060.04513.85
5.3.90.0090.04013.94
5.3.80.0070.03313.75
5.3.70.0100.04013.71
5.3.60.0100.03513.76
5.3.50.0120.02813.62
5.3.40.0140.03313.76
5.3.30.0140.03713.69
5.3.20.0100.03513.48
5.3.10.0020.04613.48
5.3.00.0030.04213.43

preferences:
46.15 ms | 400 KiB | 5 Q