Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.