title: PHP: Is it better to close SoapClient connection?
body: <p>I created the following helper function:</p>
  
  <pre><code>function mainSoap(){
      return new SoapClient('https://soap.url',[
          'stream_context' =&gt; stream_context_create([
              'ssl' =&gt; [
                  'verify_peer' =&gt; false,
                  'verify_peer_name' =&gt; false,
                  'allow_self_signed' =&gt; true
              ]
          ]);
      ]);
  }
  </code></pre>
  
  <p>and I'm using it like <code>$result=mainSoap()-&gt;GetSometing($parameters);</code></p>
  
  <p><strong>Everything works fine</strong>, but in terms of performance, I would like to know if is better to close the soap connection or not.</p>
  
  <blockquote>
    <p><strong>UPDATE</strong></p>
  </blockquote>
  
  <p>I created another function in order to close the connection after getting the response, but I still could't find a close method for SoapClient.</p>
  
  <pre><code>function mainSoap(string $call=null, array $vars=[]){
      $url="https://soap.url";
      $wsdl=new SoapClient($url,[
          'trace' =&gt; false,
          'keep_alive' =&gt; false,
          'stream_context' =&gt; stream_context_create([
              'ssl' =&gt; [
                  'verify_peer' =&gt; false,
                  'verify_peer_name' =&gt; false,
                  'allow_self_signed' =&gt; true
              ]
          ]),
          'compression'   =&gt; SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | SOAP_COMPRESSION_DEFLATE
      ]);
      $response=$wsdl-&gt;__soapCall($call,$vars);
      //Looking for something like $wsdl-&gt;close();
      return $response;
  }
  </code></pre>
  
  <p>and I'm using it like <code>$result=mainSoap('GetSometing',[$parameters]);</code></p>