title: PHP alter url in html
body: <p>Is there a way to use <code>preg_replace()</code> to add a string "<code>utm=some&amp;medium=stuff</code>" at the end of all found urls found in <code>$html_text?</code></p>
  
  <pre><code>$html_text = 'Lorem ipsum &lt;a href="http://www.me.com"&gt;dolor sit&lt;/a&gt; amet, 
                &lt;a href="http://www.me.com/page.php?id=10"&gt;consectetur&lt;/a&gt; elit.';
  </code></pre>
  
  <p>So the result should be</p>
  
  <pre><code>href="http://www.me.com" ›››››
  href="http://www.me.com?utm=some&amp;medium=stuff"
  
  href="http://www.me.com/page.php?id=1" ›››››
  href="http://www.me.com/page.php?id=1&amp;utm=some&amp;medium=stuff"
  </code></pre>
  
  <p>So, if the url contains a question mark (second url) it should add a ampersand "<code>&amp;</code>" instead of a question mark "<code>?</code>" in front of "<code>utm=some...</code>"</p>
  
  <p>Ultimately it would only alter urls for the <code>domain me.com.</code></p>