title: Escape string with PHP and HTML
body: <p>I have these two lines that I would like to escape the $type variable:</p>
  
  <pre><code>$functionName = str_replace('-', '_', $type);
  $output .= '&lt;div class="tab-pane" id="'. $type .'"&gt;';
  </code></pre>
  
  <p>I tried escaping like below but its confusing me and not  sure whether thats right:</p>
  
  <pre><code>$output .= '&lt;div class="tab-pane" id="\'. $type .'\"&gt;';
  </code></pre>