Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function parse_message($str) {
- $arguments = explode(' ', $str);
- $count = count($arguments);
- $username = explode('!', substr($arguments[0], 1));
- $username = isset($username[0]) ? $username[0] : '';
- $command = isset($arguments[1]) ? $arguments[1] : '';
- $args = "";
- for($i = 2; $i < $count; $i++)
- $args .= $arguments[$i] . ' ';
- $trailing_data = stripos($str, ' :');
- $trailing_data = trim(substr($str, $trailing_data + 2));
- $trailing_data_pos = stripos($args, ' :');
- $args = trim(substr($args, 0, $trailing_data_pos));
- return array('username' => $username, 'command' => $command, 'trail' => $trailing_data, 'args' => $args);
- }
Add Comment
Please, Sign In to add comment