Jump to content

[SOLVED] Getting substring


asterixvader

Recommended Posts

Hi.

I'd like to know how to get only some parts of the names of files I upload to a page.

(Of course, the files, the upload, etc, don't matter, what matters is the name of the files, which are strings.)

 

All files names are as follow: "img ### comments.ext"

i like to take only the "comments" part, and take out the "img ###" and ".ext" parts.

 

I think it'd work perfectly with the substring function, but the detail is that the quantity of digits in the number part (###) differ from file to file, it's not always 3 digits (also the "comments" part vary).

 

I wondered if there's a way to make Php recognize the position of the second space, after the numbers (since that will always be the initial position, and the final is always -4), but I don't know! You are the Php Freaks.

 

I hope someone will help out!

Link to comment
https://forums.phpfreaks.com/topic/174265-solved-getting-substring/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.