Twitch.tv php stream feed
<p>and new to php and know some javascript but what I am trying to do is make it so when their is is 10(random number) or more streams live that it hides anything past 10 and has a Show/Hide link to expand the menu to view further. But I can't for the life of me figure out how to do this, I started by adding the variable $liveStreams and set it to 0 so whenever it uses the function onlinecheck for each user it goes .$liveStreams++; but now I am stuck on what I need to do next. Here is my code</p>

<pre><code> &lt;?php


    defined('_JEXEC') or die('Direct access to this location is not allowed.');


    $userList = $params-&gt;get('userlist');


    $usersArray = explode(',', $userList);


    $userGrab = "http://api.justin.tv/api/stream/list.json?channel=";
    $checkedOnline = array ();

    //Number of streams live
    $liveStreams=0; 

    foreach($usersArray as $i =&gt;$value){
        $userGrab .= ",";
        $userGrab .= $value;
    }
    unset($value); 


    $json_file = file_get_contents($userGrab, 0, null, null);


    $json_array = json_decode($json_file, true);


    foreach($usersArray as $i =&gt;$value){
        $title = $json_array[$i]['channel']['channel_url'];
        $array = explode('/', $title);
        $member = end($array);
        $viewer = $json_array[$i]['stream_count'];
        $topic = $json_array[$i]['title'];
        onlinecheck($member, $viewer, $topic);
        $checkedOnline[] = signin($member);
    }

    unset($value);
    unset($i);

    function onlinecheck($online, $viewers, $topic)
    {  


        if ($online != null)
            {
                        echo '&lt;table width="100%"&gt;
                                &lt;tr&gt;
                                    &lt;td align="left"&gt;&lt;img src="./modules/mod_twitchlist/tmpl/online.png"&gt;&lt;/td&gt;
                                    &lt;td align="left"&gt;&lt;a href="http://www.twitch.tv/'.$online.'"&gt;&lt;strong&gt;'.$online.'&lt;/a&gt;&lt;/strong&gt;&lt;/td&gt;
                                    &lt;td align="right"&gt;&lt;img src="./modules/mod_twitchlist/tmpl/viewers.png"&gt;&amp;nbsp' .$viewers.'&lt;/td&gt;
                                &lt;/tr&gt;'
                        .$liveStreams++;
            }   
    }

    function signin($person){
    if($person != null){
        return $person;
    }
    else{
        return null;
    }
}
?&gt;
&lt;?php

    foreach ($usersArray as $i =&gt; $value1) {
        foreach($checkedOnline as $ii =&gt; $value2){
            if($value1 == $value2){
                unset($usersArray[$i]);
            }
        }

    }
    foreach ($usersArray as $i =&gt; $value) { 
        echo '&lt;table width="60%"&gt; 
                        &lt;tr&gt;
                            &lt;td align="left"&gt;&lt;img src="./modules/mod_twitchlist/tmpl/offline.png"&gt;&lt;/td&gt;
                            &lt;td align="left"&gt;&lt;a href="http://www.twitch.tv/'.$value.'"&gt; &lt;strong&gt;'.$value.'&lt;/strong&gt;&lt;/a&gt;&lt;/td&gt;
                        &lt;/tr&gt;
              &lt;/table&gt;';
    }
?&gt;
</code></pre>
