That's a scope issue. Anything you've declared inside of a function is not visible outside of the function. You must capture the results using a return statement. You can return no more than one value, but that value can be an array or object as well, so you can capture each of these and return them.
I don't understand what you are trying to do here though; the response string regardless of the branch it takes will be broken HTML.
Oh wait, I see it now in the first post. Don't break these up like that, use either an entire function to handle the whole string, use applied formatting only when required, or use two separate functions one for data and one for format. Given what I see, what makes the most sense is a function responsible for both the data and the format.
Frankly, the data is tabular, so you should use a table; perhaps something like this would be better?
$mc = new MinecraftServerStatus();
$iTotal = 0;
$sOut = "
foreach ($servers AS $ip => $name)
$out = '';
$status = $mc->getStatus($ip);
$sOut .= "<tr>";
$sOut .= sprintf('<td style="color: green">ONLINE</td><td>%s</td><td>%d / %d</td>', $name, $status['players'], $status['maxplayers']);
$iTotal += $status['players'];
$sOut .= sprintf('<td style="color: darkred">OFFLINE</td><td>%s</td><td>0 / 0</td>', $name);
$sOut .= "</tr>";
$sOut .= "</tbody>";
$sOut .= sprintf('
<td colspan="2">Total Players:</td>
$sOut .= "</table>";
An alternative would be to extend the current class and provide it with a function just for the above.
$servers = array(
'126.96.36.199' => 'Factions',
'188.8.131.52:25555' => 'Creative'