How can I get a value outside of a for-loop?
<p>I am sending a hotel list request. My URL is:</p>

<pre>&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</pre>

<p>I need a result for this method:</p>

<pre>
&room1=2,3,5    (2 Adults, 2 Children Ages 3 & 5)
&room2=2,10  (2 Adults, 1 Children Ages 10)
</pre>

<p>How can I get this output?</p>

<p>Here is my code:</p>

<pre><code>for ($i=0;$i&lt;$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&lt;$child =$arraoy['room-'.$i.'-child-total'];$j++)
    {
        echo $age[]= $arraoy['room-'.$i.'-child-'.$j.'-age'];
        echo",";
    }

    echo"&lt;br&gt;";
}
</code></pre>

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