title: For loop decreasing order value
body: <p><strong>Problem</strong>
  I have made the for loop decreasing but the value <strong>$k</strong> is not coming in opposite manner. Below is the code which am running to get it working any help will be great.</p>
  
  <p>Basically am dealing with iFrame and I want to fetch the Parent URL data, for that i am using <strong>$_SERVER['HTTP_REFERER']</strong>. I am getting the parent URL perfectly but when am breaking the string I want it to be in opposite manner. Please look at the actual and desired result below.</p>
  
  <p><strong>URL:</strong> <a href="http://www.example.net/home?game_id=MyTeam11game_type=activity&amp;auth=success" rel="nofollow">http://www.example.net/home?game_id=MyTeam11game_type=activity&amp;auth=success</a></p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>$mainurl = array();
  $mainurl = parse_url($_SERVER['HTTP_REFERER']);
  $mainurl = array_slice($mainurl, 3, true);
  $mainurl = $mainurl['query'];
  $mainurlArr = explode('&amp;', $mainurl);
  for($k=count($mainurlArr)-1; $k&gt;=0; $k--){
      echo $mainurlArr[$k].' ,pos=&gt; '.$k."&lt;br /&gt;";
  }
  </code></pre>
  
  <p><strong>Actual Output</strong></p>
  
  <pre><code>auth=success ,Actual pos=&gt; 2
  game_type=activity ,Actual pos=&gt; 1
  game_id=Pranavs%20running12 ,Actual pos=&gt; 0
  </code></pre>
  
  <p><strong>Desired Output</strong></p>
  
  <pre><code>auth=success ,Actual pos=&gt; 0
  game_type=activity ,Actual pos=&gt; 1
  game_id=Pranavs%20running12 ,Actual pos=&gt; 2
  </code></pre>