public function convert($string, $target)
    {
        $ok_methods = [self::CONVERT_TO_LC, self::CONVERT_TO_ND, self::CONVERT_TO_LCND];

        if (!in_array($target, $ok_methods)) {
            throw new Exception_InvalidArgument(
                sprintf('Invalid argument 2 "%s", valid values are [%s].'
                    , $target
                    , implode('|', $ok_methods)
                )
            );
        }
        if (function_exists('phrasea_utf8_convert_to')) {
            return phrasea_utf8_convert_to($string, $target);
        }

        $out = '';
        $_map = $this->getMap($target);   // faster in loop
        $length = mb_strlen($string, 'UTF-8');

        for ($i = 0; $i < $length; $i++) {
            if (true === array_key_exists(($c = mb_substr($string, $i, 1, 'UTF-8')), $_map)) {
                $out .= $_map[$c];
            } else {
                $out .= $c;
            }
        }

        return $out;
    }
public function convert($string, $target)
    {
        $ok_methods = [self::CONVERT_TO_LC, self::CONVERT_TO_ND, self::CONVERT_TO_LCND];

        if (!in_array($target, $ok_methods)) {
            throw new Exception_InvalidArgument(
                sprintf('Invalid argument 2 "%s", valid values are [%s].'
                    , $target
                    , implode('|', $ok_methods)
                )
            );
        }
        if (function_exists('phrasea_utf8_convert_to')) {
            return phrasea_utf8_convert_to($string, $target);
        }

        $out = '';
        $_map = $this->getMap($target);   // faster in loop
        $length = mb_strlen($string, 'UTF-8');

        for ($i = 0; $i < $length; $i++) {
            if (true === array_key_exists(($c = mb_substr($string, $i, 1, 'UTF-8')), $_map)) {
                $out .= $_map[$c];
            } else {
                $out .= $c;
            }
        }

        return $out;
    }
public function convert ( $ string , $ target ) { $ ok_methods = [ self :: CONVERT_TO_LC , self :: CONVERT_TO_ND , self :: CONVERT_TO_LCND ] ; if ( ! in_array ( $ target , $ ok_methods ) ) { throw new Exception_InvalidArgument ( sprintf ( 'Invalid argument 2 "%s", valid values are [%s].' , $ target , implode ( '|' , $ ok_methods ) ) ) ; } if ( function_exists ( 'phrasea_utf8_convert_to' ) ) { return phrasea_utf8_convert_to ( $ string , $ target ) ; } $ out = '' ; $ _map = $ this -> getMap ( $ target ) ; // faster in loop $ length = mb_strlen ( $ string , 'UTF-8' ) ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { if ( true === array_key_exists ( ( $ c = mb_substr ( $ string , $ i , 1 , 'UTF-8' ) ) , $ _map ) ) { $ out .= $ _map [ $ c ] ; } else { $ out .= $ c ; } } return $ out ; }
Converts a string

@param string $string
@param string $target One of the unicode::CONVERT_TO_* constants

@return string

@throws Exception_InvalidArgument
Converts a string