Been bored lately, so I'd thought I'd make an IRC bot in PHP. I wasn't sure how they worked, so I found this to be great:

I added a little more to it, using switch() instead of an if statement. So, instead of:

if ($rawcmd[1] == "!sayit") {

I changed it to


 switch(rtrim($rawcmd[1])) {


and of course everything else in between. 
See the full code here: or here
Not much has changed, but with switch() I found it easier to add more commands. Again, I didn't write most of it. Feel free to test it out though.