Can't be done without the browser sending a request back to the server, and the server responding with another page.
I can see one way of working: have an transitional page in which Javascript:
a) Gets the screen dimensions
b) Fills them into a couple of hidden form fields
c) submits the form
Then they're available to PHP, which can do as you will with them and then send back the real page.
This of course assumes many things, particularly that the browser isn't resized at any stage subsequently.