Php Cut String

Hello buddies and merry christmas
I have a string which is a file name with multi parts (my file.part001) I need to remove the (.part001) form the string so only the (my file) still.
I've tried

  1. Php Slice String
  2. Php Cut String At Character
  1. Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, PHP, Python, Bootstrap, Java and XML.
  2. Returns the extracted part of a string, or FALSE on failure, or an empty string: PHP Version: 4+ Changelog: PHP 7.0 - If string = start (in characters long), it will return an empty string. Earlier versions returns FALSE. PHP 5.2.2 - 5.2.6 - If start has the position of a negative truncation, FALSE is returned. Other versions get the string.
  3. Substr function is used to cut any part from a string in PHP. It is a built-in function of PHP that returns the portion of a string based on the starting position and the length value. The original value of the string remains unchanged after applying this function to that value.

Feb 26, 2020 The substr function used to cut a part of a string from a string, starting at a specified position. For instance, in the string 'abcdef', the character at position 0 is 'a', the character at position 2 is 'c', and so forth. If offset is negative, the returned string will start at the offset'th character from the end of string. If string is less than offset characters long, false will be returned.

but the problem I have numbers after (part) string
how to do somthing like this so any file with (part01)(part001)(part0001) witll be removed.

  • 4 Contributors
  • forum6 Replies
  • 107 Views
  • 21 Hours Discussion Span
  • commentLatest PostLatest Postby OsaMasw

Recommended Answers

Php Slice String

Why don’t you use the last dot as a delimiter?
Example:

Jump to Post

Multi touch sensor. Have you tried pathinfo()? '>http://php.net/manual/en/function.pathinfo.php

Jump to Post

All 6 Replies

Php

Why don’t you use the last dot as a delimiter?
Example:

Php Cut String At Character

Editedby jkon