How to add attributes to soapVars

php, soap

Solution

The best way to do it is:

<?php 
 $tag['_'] = 'yyy'; 
 $tag['attr'] = 'xxx'; 
 $tagVar = new SoapVar($tag, SOAP_ENC_OBJECT); 

?> 

the result would be:

<tag attr="xxx">yyy</tag>

Problem

I'd like to create soapVars with attributes like this: ``` <tag attr="xxx">yyy</tag> ``` Is this possible with the SoapVar constructor, but without using XSD_ANYXML and raw xml strings?

Original source

Related problems