Acessing php variable using jquery
<pre><code>&lt;script&gt;
    $(document).ready(function(){       
        &lt;?php 
        echo 'var timeLeft = 12796;'; 
        ?&gt;;     

        console.log(timeLeft);  
    });
&lt;/script&gt;
</code></pre>

<p>How is jquery acessing the php variable because to create a php variable we use $ and here it is using var?</p>

<p>Now how can i correct the below code because its showing me error in the console?
<pre></p>

<code>&lt;script&gt; 
var currentDate= &lt;?php echo 'strtotime("now")' ; ?&gt;; 
console.log(currentDate); 
&lt;/script&gt; 
</code></pre>

<p>Here i am using strtotime function instead of simple echoing a numbe</p>
