title: How to store the last value in my url into a variable in php?
body: <p>I have an example link here: </p>
  
  <pre><code>http://mydomain.com/myapp1/index.php/image/index/album/check+picture/id/1
  </code></pre>
  
  <p>Now I'm trying to retrieve the "1" at the very end of the url.</p>
  
  <p>So far, I've tried the following code:</p>
  
  <pre><code> $id = $_GET['id'];
  </code></pre>
  
  <p>But it is not working. I was used to the url having the <code>index.php?id=1</code> Syntax but I'm not entirely sure how to get this one working.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Before accepting an answer, I wanted to add this script I used to get the entire URL of the current page:</p>
  
  <pre><code> $protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https') === FALSE ? 'http' : 'https';
      $host     = $_SERVER['HTTP_HOST'];
      $script   = $_SERVER['SCRIPT_NAME'];
      $params   = $_SERVER['QUERY_STRING'];
      $currentUrl = $protocol . '://' . $host . $script . '?' . $params;
  
      echo $currentUrl;
  </code></pre>
  
  <p>When it echoes, it only prints out:</p>
  
  <p><a href="http://www.mydomain.com/myapp1/index.php" rel="nofollow">http://www.mydomain.com/myapp1/index.php</a>?</p>