How to do escaping of quotes in php?

There is such piece of code:
<script type="text/javascript">
 var expanded=<?=if($_SESSION['hide'])?"false":"true"?>;

But when executed the error "Parse error: syntax error, unexpected T_IF in...".
Can't figure out how to correctly escape the quotes, tried in different ways, still error.
July 8th 19 at 16:07
1 answer
July 8th 19 at 16:09
Remove the "if". Leave only the $_SESSION['hide'] ? "false" : "true"

Find more questions by tags JavaScriptPHP