title: PHP Parse URL From Current URL
body: <p>I am trying to parse url and extract value from it .My url value is <code>www.mysite.com/register/?referredby=admin</code>. I want to get value <code>admin</code> from this url. For this, I have written following code. Its giving me value <code>referredby=admin</code>, but I want only <code>admin</code> as value. How Can I achieve this? Below is my code:</p>
  
  <pre><code>&lt;?php 
      $url = $current_url="//".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
      setcookie('ref_by', parse_url($url, PHP_URL_QUERY));
      echo $_COOKIE['ref_by'];
  
   ?&gt;
  </code></pre>