title: How can you put PHP inside a Javascript?
body: <p>I am retrieving a Facebook Page Like count via a PHP function like this:</p>
  
  <pre><code>&lt;?php
  function fbLikeCount($id,$appid,$appsecret){
  $json_url ='https://graph.facebook.com/'.$id.'?access_token='.$appid.'|'.$appsecret.'&amp;fields=likes';
  $json = file_get_contents($json_url);
  $json_output = json_decode($json);
  if($json_output-&gt;likes){
      return $likes = $json_output-&gt;likes;
  }else{
      return 0;
  }
  }
  ?&gt;
  </code></pre>
  
  <p>Then, I am able to echo this out no problem like this:</p>
  
  <pre><code>&lt;?php
  echo number_format(fbLikeCount('companynamegoeshere','XXXXXXXXXXXX','XXXXXXXXXXX'));
  ?&gt;
  </code></pre>
  
  <p>But, I am using a JavaScript function to do this animation for where teh number is displayed on the page, like this:</p>
  
  <pre><code>&lt;script&gt;
  $({someValue: 0}).animate({someValue: 450700}, {
  duration: 3000,
  easing: 'swing',
  step: function () {
     $('#facebookCount').text(commaSeparateNumber(Math.round(this.someValue)));
  },
  complete:function(){
        $('#facebookCount').text(commaSeparateNumber(Math.round(this.someValue)));
    }
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>Where that 450700 is in the JS code is where I need to put the PHP echo'ed number. Is it even possible to put a PHP echo (if I make it a variable first?) into the JS.</p>
  
  <p>I've tried many, many things and hitting a brick wall. Any help is greatly appreciated.</p>
  
  <p>thanks!</p>