There is an open source PHP program based on the MIT License
http://code.google.com/p/php-mobile-detect/
The program is just a file, you can just quote it directly after downloading.
How to use:
<span><?php</span> <span>include</span><span>(</span><span>"Mobile_Detect.php"</span><span>)</span><span>;</span> <span>$detect</span> <span>=</span> <span>new</span> Mobile_Detect<span>(</span><span>)</span><span>;</span> <span>if</span> <span>(</span><span>$detect</span><span>-></span><span>isMobile</span><span>(</span><span>)</span><span>)</span> <span>{</span> <span>// any mobile platform</span> <span>echo</span> <span>'isMobile'</span><span>;</span> <span>}</span> <span>else</span><span>{</span> <span>echo</span> <span>'isPC'</span><span>;</span> <span>}</span> <span>?></span>