1<script type="text/javascript">
2var abc= 'this is text';
3<?php $abc = "<script>document.write(abc)</script>"?>
4</script>
5<?php echo $abc;?>
1<script type="text/javascript">
2 var php_var = "<?php echo $php_var; ?>";
3</script>
1<script>
2 var res = "success";
3</script>
4<?php
5 echo "<script>document.writeln(res);</script>";
6?>
1<script>
2var p1 = "success";
3</script>
4
5<?php
6echo "<script>document.writeln(p1);</script>";
7?>
1<script type="text/javascript">
2// boolean outputs "" if false, "1" if true
3var bool = "<?php echo $bool ?>";
4
5// numeric value, both with and without quotes
6var num = <?php echo $num ?>; // 7
7var str_num = "<?php echo $num ?>"; // "7" (a string)
8
9var str = "<?php echo $str ?>"; // "A string here"
10</script>