You will have to include the var in some page, in a form or a redirection and send that to a php file and then get the variable. Since javascript is client only, there has to be some page (html/php) that sends the value to a php page.
see example below (not tested)
page1.html:
<body>
<script language="javascript">
var php="php is good";
self.document.myform.test.value == php;
</script>
<form action="yourfile.php" name="myform">
<input type="text" name="test" value="">
</body>