I have created the following custom class in PHP:
<?php
class myClass
{
public $property1;
public $property2;
}
?>
I have a NuSoap Webservice that I want to use to return an array of these objects in XML format. I have built the following function to return the data:
foreach($response->return->object as $object)
{
$returnObject = new $myClass;
$returnObject->property1 = $object->property1;
$returnObject->property2 = $object->property2;
array_push($returnObjects, $returnObject);
}
}
$result = array_unique($returnObjects);
if (count($result) != 0){
return $result;}
When I run the method, I get the following error:
Object of class MyClass could not be converted to string
Any assistance would be greatly appreciated! Thanks in advance.