I have declared a javascript variable ,
var myJavascriptVar = 12345;
And unable to assign that value to php variable;
I guess you can use cookies for it.
1) First add a cookie jquery plugin.
2) Then store that window width in a cookie variable.
3) Access your cookie in PHP like $_COOKIE['variable name'].
http://www.w3schools.com/php/php_cookies.asp
Javascript will be interpreted in Client's browser and you can not assign it to PHP variable which is interpreted on SERVER .
Feasible Solution : You can submit the Javascript value via ajax or through form submit.