<p>Mobile Safari is a very capable browser, and it can handle my website as it is perfectly. However, there are a few elements on my page that could be optimized for browsing using this device; such as serving specific thumbnails that are smaller than the desktop counterparts to help fit more content into the screen.</p>

<p>I would like to know how I can detect Mobile Safari (all versions, preferably) using PHP, so then I can serve a) a specific css file and b) different sized image thumbnails.</p>

```
```
$_SERVER['HTTP_USER_AGENT']
```
```
That will give you the user-agent string back which you can compare to mobile safari.
p.s.
http://wurfl.sourceforge.net/
WURFL may help you determine which UAs you want.