src/Utilities/Miscellaneous.php
public static function getStringElements($string, $separator)
    {
        $matches = [];
        $pattern = sprintf('|[^\%s]+|', $separator);
        $matchCount = preg_match_all($pattern, $string, $matches);

        if ($matchCount > 1) {
            return $matches[0];
        }

        return [];
    }
public static function getStringElements($string, $separator)
    {
        $matches = [];
        $pattern = sprintf('|[^\%s]+|', $separator);
        $matchCount = preg_match_all($pattern, $string, $matches);

        if ($matchCount > 1) {
            return $matches[0];
        }

        return [];
    }
public static function getStringElements ( $ string , $ separator ) { $ matches = [ ] ; $ pattern = sprintf ( '|[^\%s]+|' , $ separator ) ; $ matchCount = preg_match_all ( $ pattern , $ string , $ matches ) ; if ( $ matchCount > 1 ) { return $ matches [ 0 ] ; } return [ ] ; }
Returns elements of given string divided by given separator

@param string $string    The string to check
@param string $separator The separator which divides elements of string
@return array
Returns elements of given string divided by given separator