I figured out sometimes assigning php variable to javascript is fine but assigning javascript variable value to php's variable is not usually assigned
Option 1 :
  <script type="text/javascript">
  <?php 
  if($page == "home"){ 
   echo 'var page = "home"';
  }else{ ?>
   echo 'var page = "non-home"';
  } ?>
  </script>
Option 2:
<script type="text/javascript">
var page = "home";
if(page == "home"){
<?php $page = "home"; ?>    
}else{
<?php $page = "non-home"; ?>   
}
</script>
In the above 2 option, Is it option 2's php variable "$page" will not be assigned because the server will run php code first?
Can I conclude that I can assign any php variable to javascript variable but cannot assign javascript variable to php variable?
