You have 2 errors. First you have $ before print_r
. Second one is that you print it in a foreach loop, but you should print everything after the loop. Give a shot code below:
$streamstats = array();
$username = array("streamerhouse", "cohhcarnage");
foreach($username as $stream) {
$data = json_decode(file_get_contents('http://api.justin.tv/api/stream/list.json?channel=' . $stream));
$streamstats[] = $data;
}
print_r($streamstats);