$width = "<script>var windowWidth = screen.width; document.writeln(windowWidth); </script>"; $height = "<script>var windowHeight = screen.height; document.writeln(windowHeight); </script>"; echo 'This screen is : '.$width.' x '.$height;