how to change php variable value in javascript

Solutions on MaxInterview for how to change php variable value in javascript by the best coders in the world

showing results for - "how to change php variable value in javascript"
Eryn
07 Feb 2017
1<script> 
2  document.cookie = "js_var = " + This is used to chang js to php 
3</script>
4<?php
5    $php_var= $_COOKIE['js_var'];
6	echo $php_var;
7?>
Benjamín
25 Sep 2019
1<?php
2$php_var = "This is used to change php values to js";
3?>
4<script>
5var js_var = '<?php echo $php_var ;?>';
6document.write(js_var);
7</script>