PHP Get last word of url returning blank
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/11075301/php-get-end-string-on-url-between-and">PHP Get end string on url between / and /</a>  </p>
</blockquote>



<p>I have this code to get the last part of the url between / and / at the end.</p>

<p>The url is:</p>

<pre><code>http://mydomain.com/category/mobile/
</code></pre>

<p>I need to retrieve "mobile" from it.</p>

<p>The code i'm using is:</p>

<pre><code>$url = trim($url, '/');

//Put it in a variable
$the_category = substr($url, strrpos($url, '/'));

//whats in it?
echo $the_category;
</code></pre>

<p>The above returns nothing ... any ideas?</p>
