you could try this it may be slower than explode but you're only talking milliseconds..
/ Create An Infinite Loop.
while(1) {
while($data = fgets($socket)) {
/* Seperate All Data */
preg_match("/^:(.*?)!(.*?)@(.*?)[\s](.*?)[\s](.*?)[\s]:(.*?)$/",$data, $rawdata);
$nick = $rawdata[1];
$ident = $rawdata[2];
$host = $rawdata[3];
$msg_type = $rawdata[4];
$channel = $rawdata[5];
$message = rtrim($rawdata[6]);
$ex = explode(' ', $data);
/* Create the Commands Trigger */
$message = explode(" ", trim($message));
$trigger = array_shift($message);
$message = implode(" ", $message);
/* Send PONG Back To The Server. */
if($ex[0] == "PING"){ fputs($socket, "PONG ".$ex[1]."\n"); }
...
...
But keep using the $ex array for IRC events other than user events.