I am sending a hotel list request. My URL is:

```
&numberOfRooms=2&room-0-adult-total=1&room-0-child-total=1&room-1-adult-total=1&room-1-child-total=0&room-0-child-0-age=2&button=search
```

I need a result for this method:

```

&room1=2,3,5    (2 Adults, 2 Children Ages 3 & 5)
&room2=2,10  (2 Adults, 1 Children Ages 10)

```

How can I get this output?

Here is my code:

```
for ($i=0;$i<$arraoy[numberOfRooms];$i++)
{
    echo"room_adut$i=";
    echo $adult[] = $arraoy['room-'.$i.'-adult-total'];
    $child =$arraoy['room-'.$i.'-child-total'];
    echo",";

    for($j=0;$j<$child =$arraoy['room-'.$i.'-child-total'];$j++)
    {
        echo $age[]= $arraoy['room-'.$i.'-child-'.$j.'-age'];
        echo",";
    }

    echo"<br>";
}

```

I can print the inner for-loop and the result is correct. But how can I get the value outside of the for-loop?