I found this script on the web.
Naturally it uses a javascript.
The script does a reload with the width in GET variable.
The variable is put into SESSION.
After another reload the current width is accessible in the SESSION['browser_width']
<?php
session_start();
if(isset($_SESSION['browser_width'])){
echo 'User browser width: ' . $_SESSION['browser_width'];
//$_SESSION = array(); use when testing
} else if(isset($_GET['width'])) {
$_SESSION['browser_width'] = $_GET['width'];
header('Location: ' . $_SERVER['PHP_SELF']);
} else {
echo '<script type="text/javascript">window.location = "'
. $_SERVER['PHP_SELF'] . '?width="+innerWidth</script>';
}
?>