Because the sql types could be combined it would be better to use a function like this:
function getMySQLType($str){
$str=trim($str);
return strtoupper(substr($str,0,strpos($str,' ')));
}
$sql="select * from user;";
if (getMySQLType($sql) == 'SELECT'){
//true
}