Your questions have been answered. However, in case you are wondering WHY you can't measure screen width and height with PHP, given that it's a very comprehensive language...
PHP is a server-side scripting language. This means that ALL of the code runs on the server, before it ever gets to the user. That is why you have to use Javascript. Javascript is a CLIENT side scripting language, and can read all sorts of information about your system.