Removing last part of string divided by a colon

Posted by Harry Beasant on Stack Overflow See other posts from Stack Overflow or by Harry Beasant
Published on 2012-09-08T21:24:44Z Indexed on 2012/09/08 21:38 UTC
Read the original article Hit count: 183

Filed under:
|

I have a string that looks a little like this, world:region:bash

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 world:region:bash

I need to get this world:region

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.

© Stack Overflow or respective owner

Related posts about php

Related posts about string