从字符串中删除一些文本[关闭]

I have a PHP variable that outputs some text on the page i.e. here's the text it outputs

http://URL.com/uploads/gravity_forms/3-464e6bdac9890814218993b7e45c1736/2013/01/hehehecsv10.csv

I would like to remove everything from this text and only show hehehecsv10.csv , how would I go about doing this in PHP

$str = 'http://URL.com/uploads/gravity_forms/3-464e6bdac9890814218993b7e45c1736/2013/01/hehehecsv10.csv';

echo end(explode("/",$str));
echo basename($str);

The function you're looking for is called basename()Docs:

$string = 'http://URL.com/uploads/gravity_forms/3-464e6bdac9890814218993b7e45c1736/2013/01/hehehecsv10.csv';
echo basename($string); # hehehecsv10.csv

Output is as commented, try the demo if you need to play around with it.

See as well a somehwat related question: