title: Check if div ID exists in PHP
body: <p>I have same php to generate HTML in 2 ocasions:</p>
  
  <ol>
  <li>Generate a link with <code>target="_new"</code>;</li>
  <li>Generate a link without target property.</li>
  </ol>
  
  <p>The only way that I have to differentiate both of them is to create the parent div as different ID (eg: <code>&lt;div id="new"&gt;</code> for the 1st, '' for the 2nd.</p>
  
  <p>Is there any way to check if has some <code>#new</code> in html and them set target?</p>
  
  <p>Here's the way that I've tried so far:</p>
  
  <pre><code>&lt;?php $new = $html-&gt;find("#new"); ?&gt;
  &lt;a href="&lt;?php echo $item-&gt;getPrimaryLink()-&gt;getUrl(); ?&gt;" &lt;?php if (is_object($new)): ?&gt; target="_new" &lt;?php else : ?&gt; &lt;?php endif; ?&gt; &gt;
  </code></pre>