PHP | Manipulate Array inside function

Viewed 20

I have the following code:

function GetAllOnlinePlayerCount() {
    $OnlinePly = GetAllOnlinePlayers();
    $OnlineCount = count($OnlinePly);

    return $OnlineCount;
}

$server['online_members'] = GetAllOnlinePlayerCount();

This is loaded when the page loads. To refresh the online_members value I have to reload the page. I rather want to refresh it when calling the function again. So basically manipulate an array outside an function from inside an function. How can I do this?

0 Answers
Related