Posted By

Mikushi on 09/18/10


Tagged

php system chat


Versions (?)

Chat system example


 / Published in: PHP
 

  1. <?php
  2. /**
  3.  * Add a message to the chat
  4.  * @param Redis $redis Redis connection handler
  5.  * @param String $message message to add
  6.  * @return void
  7.  */
  8. function addMessage($redis, $message) {
  9. $redis->lPush("chat", $message);
  10. if($redis->lLen("chat") > 100) {
  11. $redis->rPop("chat");
  12. }
  13. }

Report this snippet  

You need to login to post a comment.