title: Insert PHP Integer Variable into HTML
body: <p>I have a PHP code that draws my subscriber count from my YouTube channel and sets it as an integer variable, <code>$subs</code>. I need to use the variable <code>$subs</code> in this piece of HTML code.</p>
  
  <p><strong>HTML Code:</strong></p>
  
  <pre><code>&lt;div class="col-md-6 bottommargin-sm"&gt;
      &lt;div class="counter counter-small"&gt;&lt;span data-from="100" data-to="$subs" data-refresh-interval="50" data-speed="2000" data-comma="true"&gt;&lt;/span&gt;&lt;/div&gt;
          &lt;h5 class="nobottommargin"&gt;Subs&lt;/h5&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>PHP Code:</strong></p>
  
  <pre><code>&lt;?php
      set_time_limit(0);
      function retrieveContent($url){
          $file = fopen($url,"rb");
  
          if (!$file) return "";
          while (feof ($file)===false) {
              $line = fgets ($file, 1024);
              $salida .= $line;
          }
  
          fclose($file);
          return $salida;
      }
          {
              $content = retrieveContent("youtube.com/user/geekawhat/about"); $start = strpos($content,'&lt;span class="about-stat"&gt;&lt;b&gt;');
              $end = strpos($content,'&lt;/b&gt;',$start+1);
              $output = substr($content,$start,$end-$start);
              $subs = (int)$output;
              echo "$output";
           }
  ?&gt;
  </code></pre>
  
  <p>It is a counter, and I want it to count to whatever that variable equals. I have placed the variable in the data-to field, which informs the counter what to count upto - how do I get this to work? (<strong>This does work btw with a number inserted into the data-to field</strong>)</p>