Looks to me like you are not actually working with classes, if the code you have given is what you mean by checking whether a class is set. THat is just an array, which you call 'classes' but you mean: User categories, or something.
If you are indeed not working with objects & classes and you really want to test which type of user there is, I would probably create an array $titles[] and set the key to whichever user types you have defined. You can then use usertype to get the right title out.