I'm querying a SOAP web-service using a WSDL file and sometimes you get a single or many elements of the same name. In the former case, PHP will turn it into a single object, in the latter it will become an array of objects.
Isn't there a sane way to always have these entries in an array? Currently, I'm checking if a property of the object is set, and if it is, I place the whole object into a new array. Then I can always just loop through them, and not have to worry about that from this point on.
I feel like I'm missing something here, since this appears to be a common problem. Do I really have to write some abstraction myself to handle this? I mean, it's in the XSD, so PHP should know that there can be more than one element of the same name and do the sane thing, right?