How to have PHP boolean FALSE to be output as FALSE only
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/10290278/transfer-a-variable-from-php-to-js">transfer a Variable from php to js</a>  </p>
</blockquote>



<p>This might seem trivial. I am setting a PHP variable's value as false. Then after some processing I am outputting some JavaScript variables in a script. This is the code</p>

<pre><code>$a = true;
$b = false;
echo '&lt;script type="text/javascript"&gt;
          var a = '.$a.';
          var b = '.$b.';
      &lt;/script&gt;';
</code></pre>

<p>When the script finishes I get this output:</p>

<pre><code>var a = 1;
var b = ;
</code></pre>

<p>So I get syntax error in JavaScript. Now the question is, how to have those values as true boolean values in JavaScript as well? </p>

<p>Intended output:</p>

<pre><code>var a = true;
var b = false;
</code></pre>

<p>I don't want string like <code>'true'</code> or <code>'false'</code>...or 1 and 0, but boolean <code>true</code> and <code>false</code> only. Any help regarding this, also with some explanation as to why PHP behaves this way?</p>
