Passing Data from Javascript to PHP

<?php
//if the variable is "variable"
$value = '<script type="text/javascript">
<!--
var a = (document.title);
document.write(a);
//-->
</script>';
echo $value;
?>