Detecting environment

I’m working on a project that gets PHP variables. How can I detect whether the swf is being played in a browser or in the flash player (or IDE)? It would make debugging a lot easier.