-1

Possible Duplicate:
PHP Get File Name Without File Extension

Using php, how would I remove a certain set of characters from a string. For example I want to go from:

http://www.domain.com/folder/image.gif

to

image

I want to remove everything except the name of the image.

Community
  • 1
  • 1
cusejuice
  • 10,285
  • 26
  • 90
  • 145
  • Look into [`basename()`](http://php.net/basename) and/or [`parse_url`](http://php.net/parse_url). – mario Jan 21 '13 at 23:58

1 Answers1

0

So you just want the filename? use pathinfo().

$name = pathinfo('http://www.domain.com/folder/image.gif', PATHINFO_FILENAME);
Austin Brunkhorst
  • 20,704
  • 6
  • 47
  • 61