El array inicial es:
Código PHP:
stdClass Object ( [return] => Array ( [0] => stdClass Object ( [description] => [id] => 543 [name] => Alojamiento y Desayuno ) [1] => stdClass Object ( [description] => [id] => 544 [name] => Media Pensión ) [2] => stdClass Object ( [description] => [id] => 541 [name] => Pensión Completa ) [3] => stdClass Object ( [description] => [id] => 542 [name] => Sólo Alojamiento ) [4] => stdClass Object ( [description] => [id] => 61 [name] => Todo incluido ) ) )
Código PHP:
Array ( [0] => stdClass Object ( [description] => [id] => 543 [name] => Alojamiento y Desayuno ) [1] => stdClass Object ( [description] => [id] => 544 [name] => Media Pensión ) [2] => stdClass Object ( [description] => [id] => 541 [name] => Pensión Completa ) [3] => stdClass Object ( [description] => [id] => 542 [name] => Sólo Alojamiento ) [4] => stdClass Object ( [description] => [id] => 61 [name] => Todo incluido ) )
$countries es la variable que devuelve el webservice
Código PHP:
$a= $countries->return;
print_r ($a);echo "<br>";
stdClass Object ( [description] => [id] => 543 [name] => Alojamiento y Desayuno )
stdClass Object ( [description] => [id] => 544 [name] => Media Pensión )
stdClass Object ( [description] => [id] => 541 [name] => Pensión Completa )
stdClass Object ( [description] => [id] => 542 [name] => Sólo Alojamiento )
stdClass Object ( [description] => [id] => 61 [name] => Todo incluido )
Hasta aqui todo bien.
Mi problema es que quiero poner en variables (vamos que no sé desgolsar ese objeto);
Código PHP:
$b=a[$i]->description->id;
Un alma caritativa, por favor