There is no PHP-equivelant of the Application collection in ASP; you'll have to find some other way to give you script that ability. Your best bet is to use a database field to keep track of it; when someone logs out, decrement the field. If someone logs in, increment it.
Also, by 'connected' I hope you mean 'viewing information through your script'. If you're leaving you connections open, you're in for serious resource management issues.