title: DOMDocument: how to append after <title> tag
body: <p>I have the following code and it works good so far.</p>
  
  <p>However, I try to attach the <code>&lt;link href=".." ../&gt;</code> tag below the <code>&lt;title&gt;</code> tag OR, better yet, below my last <code>&lt;meta&gt;</code> tag.</p>
  
  <p>Is there a way to accomplish this with DOMDocument? </p>
  
  <pre><code>$dom = new DOMDocument();
  $dom-&gt;loadHTML($html_data);
  
  $element = $dom-&gt;createElement( 'link');
  $element-&gt;setAttribute( 'rel', 'stylesheet' );
  $element-&gt;setAttribute( 'type', 'text/css' );
  $element-&gt;setAttribute( 'href', $url );
  $element-&gt;setAttribute( 'media', isset($media) ? $media : 'screen' );
  
  $head = $dom-&gt;getElementsByTagName('head')-&gt;item(0);
  $head-&gt;appendChild($element);
  echo $dom-&gt;saveHTML();  
  </code></pre>