title: PHP: how to add trailing slash to absolute URL
body: <p>I have a list of absolute URLs. I need to make sure that they all have trailing slashes, as applicable. So:</p>
  
  <ul>
  <li><a href="http://www.domain.com/">http://www.domain.com/</a> &lt;-- does not need a trailing slash</li>
  <li><a href="http://www.domain.com">http://www.domain.com</a>  &lt;-- needs a trailing slash</li>
  <li><a href="http://www.domain.com/index.php">http://www.domain.com/index.php</a> &lt;-- does not need a trailing slash</li>
  <li><a href="http://www.domain.com/?message=hello">http://www.domain.com/?message=hello</a> &lt;-- does not need a trailing slash</li>
  </ul>
  
  <p>I'm guessing I need to use regex, but matching URLs are a pain. Was hoping for an easier solution. Ideas?</p>