title: How to check the existence of any HTML element using a PHP condition?
body: <p>On a WordPress website, how can I check the existence of any HTML element (with ID or class) using a PHP condition?</p>
  
  <h2>This ticket solution didn't work in my case. <a href="https://stackoverflow.com/questions/20882327/check-if-div-id-exists-in-php">Check if div ID exists in PHP</a></h2>
  
  <p>Anyway, I've tried with this code:</p>
  
  <pre><code>$new = $html-&gt;find("#banner_id");
  if($new){
      echo "Exists";
  } else {
      echo "Not Exists";
  }
  </code></pre>
  
  <p>But this resulted in the following error:</p>
  
  <p><img src="https://i.stack.imgur.com/VFUlw.png" alt="error-image"></p>