title: If the last character is a "/", remove it
body: <p>I am making a search engine from scratch (lol), and I am stick with this problem:</p>
  
  <p>When a user submits a URL, my "spider" "crawls" it for other links.
  Some people of course use <code>&lt;a href="/page"&gt;</code> instead of <code>&lt;a href="http://long-domain.com/page"&gt;</code>, so I detect that with 
  <code>if(substr($link-&gt;getAttribute('href'), 0, 1) == '/')</code></p>
  
  <p>And add a domain in front of it. BUT, whenever I do add a domain, some links become <code>http://php.net//abcd</code>. As you can see its <code>//</code>.</p>
  
  <p>Now, my idea was to make my script edit the submitted URL so if it has a slash at the end, it'll be removed, but I have no idea how to remove it.</p>