src/Utilities/Miscellaneous.php
public static function getStringWithoutLastElement($string, $separator)
    {
        $elements = self::getStringElements($string, $separator);
        $lastKey = Arrays::getLastKey($elements);

        unset($elements[$lastKey]);

        return implode($separator, $elements);
    }
public static function getStringWithoutLastElement($string, $separator)
    {
        $elements = self::getStringElements($string, $separator);
        $lastKey = Arrays::getLastKey($elements);

        unset($elements[$lastKey]);

        return implode($separator, $elements);
    }
public static function getStringWithoutLastElement ( $ string , $ separator ) { $ elements = self :: getStringElements ( $ string , $ separator ) ; $ lastKey = Arrays :: getLastKey ( $ elements ) ; unset ( $ elements [ $ lastKey ] ) ; return implode ( $ separator , $ elements ) ; }
Returns string without the last element.
The string should contain given separator.

@param string $string    The string to check
@param string $separator The separator which divides elements of string
@return string
Returns string without the last element . The string should contain given separator .