Is anyone has any experience in writing a realtime chat function? How could it be done using PHP?
chats in php suck, its best to do it in java
BUT if you want to experiment with it, save each 'chat' line in a db, then just refresh the page every x seconds.. thats how most are done anyways
Java is the best at this but it can be done using PHP and HTML. Screen flashes on every refresh. You can also do this via PHP and FLASH. Do a search for Flash PHP Chat
I have made a chat room using PHP. Its not all that bad either. You can log-in and out and even post emoticons, actions and some HTML code. I found a really good tutorial which I based my script on:
To view the tutorial Click Me!