You are aware that the information you are creating is near-useless? (ie: don't spend too much time on it because no visitors really care about it)
BTW you can definately see it in the logfile, but you'll have to read the content of the logfile regularly. Most webservers (good ones) can deliver multiple copies of the logfile, so you could set one to log to disk, and another to log directly to a script.
But that's all theory.
If you go for the <script> method you may get browsers that don't support it.
If you go for the <img> method you'll need PHP to deliver a valid image. This may be a single-pixel gif, but it must be a valid image or you'll get an error on the page.
The full-PHP method taskes the most server-resources, but does not cause an extra hit on your webserver.
I'd go with the IMG method.
But please, re-consider wether this information is really usefull...
There's nothing more embarressing than visiting a website where it says
"current visitors: 2"