title: How to compare Laravel's url()->previous() with url()->current()
body: <p>It seems Laravel's <code>url()-&gt;previous()</code> and <code>url()-&gt;current()</code> is broken.
  I can't do a <code>if previous == current</code>, because <code>previous</code> outputs with http:/https: and ends with <code>/</code>, and <code>current</code> outputs without this.</p>
  <p>I thought this was not going to be a problem. I could just prepend <code>http:</code>/<code>https:</code> to the <code>url()-&gt;current()</code> and move on with my life, but apparently it was not going to be that simple.</p>
  <p><strong>The problem:</strong> $url_1 != $url_2</p>
  <p>Code:</p>
  <pre><code>$url_1 = url()-&gt;previous();
  $url_2 = url()-&gt;current();
  
  var_dump( $url_1 );
  var_dump( $url_2 );
  </code></pre>
  <p>Output:</p>
  <pre><code>string(22) &quot;http://localhost:3000/&quot;
  string(21) &quot;//localhost:3000&quot;
  </code></pre>
  <p><strong>Attempt to fix:</strong></p>
  <p>Code:</p>
  <pre><code>$url_1 = url()-&gt;previous();
  $url_2 = 'http:' . url()-&gt;current() . '/';
  
  var_dump( $url_1 );
  var_dump( $url_2 );
  </code></pre>
  <p>Output:</p>
  <pre><code>string(22) &quot;http://localhost:3000/&quot; 
  string(27) &quot;http://localhost:3000/&quot; 
  </code></pre>
  <p>So <code>$url_1</code> is still not equal to <code>$url_2</code>. Does anyone know what's going on here? Seems to me that <code>http:</code> is being treated as a single character.</p>
  <p>How can I actually compare the two, because as it is now, <code>$url_1</code> is never going to be equal to <code>$url_2</code>...</p>