This example:
$var = '<?php
$_SESSION["a"] = 1;
echo "<script>console.log($_SESSION["a"]);</script>";
?>'
returns an error because it thinks the quotes should stop before the a. If I used single quotes, the $var would instead stop in the middle. Is there another alternative that could be used to wrap the 'a' in $_SESSION["a"] around without causing errors?