Transliterator::createFromRules

transliterator_create_from_rules

(PHP >= 5.4.0, PECL intl >= 2.0.0)

Transliterator::createFromRules -- transliterator_create_from_rulesCreate transliterator from rules

설명

객체 기반 형식

public static Transliterator Transliterator::createFromRules ( string $rules [, string $direction ] )

절차식 형식

Transliterator transliterator_create_from_rules ( string $id [, int $direction ] )

Creates a Transliterator from rules.

Warning

이 함수는 현재 문서화 되어있지 않습니다; 인수 목록만을 제공합니다.

인수

rules

The rules.

direction

The direction, defaults to >Transliterator::FORWARD. May also be set to Transliterator::REVERSE.

반환값

Returns a Transliterator object on success, or NULL on failure.

참고

add a note add a note

User Contributed Notes 1 note

up
0
Viktor Karev
10 months ago
// string normalization example

$transliterator = Transliterator::createFromRules(''
                        . ':: [^йЙ];'
                        . ':: NFD;'
                        . ' [:White_Space:]+ > \' \';'
                        . ':: Upper();'
                        . ':: [:Nonspacing Mark:] Remove;'
                        . ':: NFC;', Transliterator::FORWARD);
$str = 'ручей   příklad';
echo str_replace('й', 'Й', $transliterator->transliterate($str));

// result:
// РУЧЕЙ PRIKLAD
To Top