Total sum viewers for multiple users

Errr yeah no idea what you are trying to do with that bit of PHP there…

    if ($i['http_code'] == 200) {
        // play print API
        $total = 0;
        foreach ($str['data'] as $live_chan){
            $total += $live_chan['viewer_count'];
        }
        echo $total;
    } else {
        // non 200 do somethign with the error
        // do stuff with $str has error message
    }