Harry Beasant Harry Beasant - 6 months ago 16
PHP Question

Removing last part of string divided by a colon

I have a string that looks a little like this,


It divides folder names, so i can create a path for FTP functions.

However, i need at some points to be able to remove the last part of the string, so, for example

I have this

I need to get this

The script wont be able to know what the folder names are, so some how it needs to be able to remove the string after the last colon.


I should probably highlight that strrpos not strpos finds last occurrence of a substring in given string