There is no way to know for sure. About the best you can do is look at the $_SERVER['HTTP_USER_AGENT'] string and make some educated guesses. There are probably some 3rd party classes/functions out their you could find, but ultimately it's still a guess since that header can be spoofed or omitted, plus new devices/browsers may be coming out with new strings all the time.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation