public static function explodeEscaped($delimiter, $string, $escapeChar = '\\')
    {
        $d = preg_quote($delimiter, "~");
        $e = preg_quote($escapeChar, "~");
        $tokens = preg_split(
            '~' . $e . '(' . $e . '|' . $d . ')(*SKIP)(*FAIL)|' . $d . '~',
            $string
        );
        return preg_replace(
            ['~' . $e . $e . '~', '~' . $e . $d . '~'],
            [$escapeChar, $delimiter],
            $tokens
        );
    }
public static function explodeEscaped($delimiter, $string, $escapeChar = '\\')
    {
        $d = preg_quote($delimiter, "~");
        $e = preg_quote($escapeChar, "~");
        $tokens = preg_split(
            '~' . $e . '(' . $e . '|' . $d . ')(*SKIP)(*FAIL)|' . $d . '~',
            $string
        );
        return preg_replace(
            ['~' . $e . $e . '~', '~' . $e . $d . '~'],
            [$escapeChar, $delimiter],
            $tokens
        );
    }
public static function explodeEscaped ( $ delimiter , $ string , $ escapeChar = '\\' ) { $ d = preg_quote ( $ delimiter , "~" ) ; $ e = preg_quote ( $ escapeChar , "~" ) ; $ tokens = preg_split ( '~' . $ e . '(' . $ e . '|' . $ d . ')(*SKIP)(*FAIL)|' . $ d . '~' , $ string ) ; return preg_replace ( [ '~' . $ e . $ e . '~' , '~' . $ e . $ d . '~' ] , [ $ escapeChar , $ delimiter ] , $ tokens ) ; }
Splits a string into elements handling an escaped delimiter.
@param string $delimiter
@param string $string
@param string $escapeChar
@return array
Splits a string into elements handling an escaped delimiter .