RESULTADO ESEPRADO
<ns1:guestcounts>
<ns1:guestcount count="2" agequalifyingcode="10" age="30"</ns1:guestcount>
<ns1:guestcount count="1" agequalifyingcode="8" age="8"></ns1:guestcount>
<ns1:guestcount count="1" agequalifyingcode="8" age="4"></ns1:guestcount>
</ns1:guestcounts>
RESULTADO RETORNADO
<ns1:guestcounts>
<ns1:guestcount count="1" agequalifyingcode="8" age="4"></ns1:guestcount>
</ns1:guestcounts>
Código PHP:
/*ARREGLOS */
$guests = array();
$guests[] = array(
"count" => 2,
"ageQualifyingCode" => 10,
"age" => 30
);
$guests[] = array(
"count" => 1,
"ageQualifyingCode" => 8,
"age" => 8
);
$guests[] = array(
"count" => 1,
"ageQualifyingCode" => 8,
"age" => 4
);
print_r($guests);
$rooms = array();
$rooms[] = array(
"RPH" => 1,
"quantity" => 1,
"guests" => $guests
);
/* OBJETOS */
class GuestCounts {
private $GuestCount;
public function __construct($guests)
{
$nguests = count($guests);
for ($i=0; $i<$nguests ; $i++) {
$this->GuestCount = new GuestCount($guests[$i]);
}
}
}
class RoomStayCandidate {
private $GuestCounts;
public function __construct($room)
{
$this->GuestCounts = new GuestCounts($room['guests']);
$this->RPH = $room['RPH'];
$this->Quantity = $room['quantity'];
}
}