Harry Beasant Harry Beasant - 2 years ago 80
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.

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download