1

I need to get the name of the file from url

$url = 'http://p1.pichost.me/i/53/1770973.jpg'

$fileName = getFileName($url);

is there some php function to do this

Hitesh
  • 4,098
  • 11
  • 44
  • 82

1 Answers1

4

You can use basename() in this case:

$url = 'http://p1.pichost.me/i/53/1770973.jpg';
$filename = basename($url);
echo $filename; // 1770973.jpg
Kevin
  • 41,694
  • 12
  • 53
  • 70