I'm developing a forum and I need to count the number of online persons.
According to old questions which are related to it, they says the count()
function should be used.
But the count()
function counts just specific user's session variables.
I mean in codeigniter, count($_SESSION['user'])
gives number 2
and this number points to $_SESSION['user']['name']
and $_SESSION['user']['group']
.
So every user sees number 2
in their screen as online person number. But I need to number of allocated $_SESSION['user']
variable in the server, not number of specific session variable's sub variables. What is the solution? How can I detect number of online persons?