Here's the thread It took all of 10 seconds. 😃 And the thread title gives it away!
Remember, this "if" statement is not fool proof. The user agents of pc web browsers are non standard (brower, OS, version, compatibilty are anywhere in the string), can be easily changed, and cannot be trusted. However, the user agents of cell phones are quite standardized and downright easy to use in comparison, barring a few.
If you are using a Nokia, then the beginning of the user agent string SHOULD be "Nokia3390/x.x...blah,blah." Similarly, most, but not all Samsung useragents will start out with "Sam..." I have seen a better if statement which lists a few dozen cell phone manufacturers using the first three letters of this. Can't find it right now.
Or you can make an if statement of your own. I can give you the 1000+ unique useragents that have visited my wap site. Out of that, there are about 250 unique models, and when you remove the model numbers, it should be quite a short list. (/me seen trying to figure out how to dump a mysql table...)
And if you come up with something useful, share it here, because I've also been trying the same for a while now.