I am working with an job API and I was almost about ready to tidy things up and make it live until i tested it and found out that when I was doing a search and only receiving one job the code broke.
When searching and getting a result with more than 1 job everything is fine and here is the data i get in the array:
stdClass Object ( [return] => stdClass Object ( [dtos] => Array (
- => stdClass Object ( [address] => stdClass Object ( [address1] => [city] => Alexandria [countryID] => 1
Then when I only get 1 job returned i get this:
stdClass Object ( [return] => stdClass Object ( [dtos] => stdClass Object ( [address] => stdClass Object ( [address1] => [city] => Alexandria [countryID] => 1
you can see the dtos is an array on the multiple return but a string if there is only 1
Currently I am using a for each loop to get the data:
<?php foreach($findResult->return->dtos as $value):?>
but is there a way to either convert the string to an array or another way to read in the data from the dtos?