Reputation: 13853
Looking for a way of getting the path from an URL in PHP:
I want to take: http://example.com/hurrdurr
And make it: hurrdurr
I only want the text after .com/
Can i do this with trim?
Upvotes: 10
Views: 18726
Reputation: 1608
For this particular case you could also use "basename" for your purposes.
$var='http://twitter.com/pwsdedtch';
echo basename($var);
// pwsdedtech
Upvotes: 8