title: Remove HTML tags and its content based on ID with PHP
body: <ul>
  <li>I would like to remove some HTML tags and its content from a HTML file based on the id/class's html element.</li>
  <li>The tag itself doesn't matter.</li>
  </ul>
  
  <p>Here's my code in PHP :</p>
  
  <pre><code>$homepage = file_get_contents("assets/page.html");
  $removeTagsbyID = ['button' , 'navbar'];
  foreach ($removeTagsbyID as $removeTagbyID) {
      $pattern = "#&lt;(.*?)$removeTagbyID(.*?)&gt;#is";
      $homepage = preg_replace($pattern, '', $homepage);
  }
  </code></pre>
  
  <p>For example if my array contains the id "navbar",</p>
  
  <pre><code>&lt;div id="top-bar"&gt;&lt;div id="navbar"&gt;Content&lt;/div&gt;&lt;/div&gt;
  </code></pre>
  
  <p>It should give :</p>
  
  <pre><code>&lt;div id="top-bar"&gt;&lt;/div&gt;
  </code></pre>