Get the current URL but remove the ? and text after this
<p>I've got a fairly trivial question but I'm not sure what the wording is to find a solution in google.</p>

<p>Currently I am using this to get my url...</p>

<pre><code>&lt;?php $url = $_SERVER["REQUEST_URI"]; ?&gt;
</code></pre>

<p>But the problem is that it is including this <strong>?orderby=newest</strong></p>

<p>My question how can I get the URL but exclude the <code>?</code>, and any text that appears after the question mark?</p>

<p>So if the URL looks like this.</p>

<pre><code>www.example.com?orderby=oldest
</code></pre>

<p>Then the returned URL looks like this...</p>

<pre><code>www.example.com
</code></pre>
