Web Designer does not support PHP, it uses jQuery for all the functionality of the website.
Assuming you want to capture the viewer browser to deliver, for example, a mobile phone compliant version - Web Designer already does this.
With most templates you will see a tab for a Mobile and Main variant, some templates eg a supersite may only have one version. On publishing the appropriate code to detect the users web browser is created.
If this is not what you require - what is the reason for capturing the browser type?