title: What is the difference between SoapVar and SoapParam?
body: <p>In PHP, we have <code>SoapVar</code> and <code>SoapParam</code> classes. I've been confused long enough, since there is no decent documentation of them on php.net.</p>
  
  <p>Today I was surprised to find out that those lines will produce the exact same result in the XML input:</p>
  
  <pre><code>$soapVar   = new SoapVar((object) ['Foo' =&gt; 'bar'], null, null, null, 'TagName');
  $soapParam = new SoapParam((object) ['Foo' =&gt; 'bar'], 'TagName');
  </code></pre>
  
  <p>In most <code>SoapClient</code> tutorials, I have seen snippets with <code>SoapParam</code> inside <code>SoapVar</code> whenever someone wanted to set custom <code>xsi:type</code>:</p>
  
  <pre><code>$response = $soapClient-&gt;DoSomething(
      new SoapParam(
          new SoapVar(
              (object) ['Foo' =&gt; 'bar'],
              null,
              'TypeName'
          ),
          'TagName'
      )
  );
  </code></pre>
  
  <p>That is really unintuitive, since <code>SoapVar</code> and <code>SoapParam</code> class names don't say much. The same result can be achieved by more elegant:</p>
  
  <pre><code>$response = $soapClient-&gt;DoSomething(
      new SoapVar(
          (object) ['Foo' =&gt; 'bar'],
          null,
          'TypeName',
          null,
          'TagName'
      )
  );
  </code></pre>
  
  <p>What is the purpose of <code>SoapParam</code> then? Is it just more simple version of <code>SoapVar</code>? It seems like these two are confused and misunderstood a lot. Is there any extra behavior attached to <code>SoapParam</code>?</p>