var testvr = <?php echo 5;?>;
When this is used in my javascript I get an "Unexpected token <" error on the line. I've seen countless examples of people setting a javascript variable like this so I'm a bit confused. I've seen some do it as
var testvr = "<?php echo 5;?>";
But that passes the code as a string to the variable. I'm really just looking for a way to simply set a javascript variable to something from php, nothing fancy at all it would just be a number such as 5.