Since: 5.4

class Transliterator (View source)

Constants

FORWARD

REVERSE

Properties

string $id

Starting 8.2 $id is readonly to unlock subclassing it

Methods

static Transliterator|null
create(string $id, int $direction = 0)

(PHP >= 5.4.0, PECL intl >= 2.0.0)
Create a transliterator

static Transliterator|null
createFromRules(string $rules, int $direction = 0)

(PHP >= 5.4.0, PECL intl >= 2.0.0)
Create transliterator from rules

createInverse()

(PHP >= 5.4.0, PECL intl >= 2.0.0)
Create an inverse transliterator

static array|false
listIDs()

(PHP >= 5.4.0, PECL intl >= 2.0.0)
Get transliterator IDs

string|false
transliterate(string $string, int $start = 0, int $end = -1)

(PHP >= 5.4.0, PECL intl >= 2.0.0)
Transliterate a string

int|false
getErrorCode()

(PHP >= 5.4.0, PECL intl >= 2.0.0)
Get last error code

string|false
getErrorMessage()

(PHP >= 5.4.0, PECL intl >= 2.0.0)
Get last error message

Details

static Transliterator|null create(string $id, int $direction = 0)

(PHP >= 5.4.0, PECL intl >= 2.0.0)
Create a transliterator

Parameters

string $id

The id.

int $direction

[optional]

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

Return Value

Transliterator|null

a Transliterator object on success, or NULL on failure.

static Transliterator|null createFromRules(string $rules, int $direction = 0)

(PHP >= 5.4.0, PECL intl >= 2.0.0)
Create transliterator from rules

Parameters

string $rules

The rules.

int $direction

[optional]

The direction, defaults to {Transliterator also be set to {Transliterator

Return Value

Transliterator|null

a Transliterator object on success, or NULL on failure.

Transliterator|null createInverse()

(PHP >= 5.4.0, PECL intl >= 2.0.0)
Create an inverse transliterator

Return Value

Transliterator|null

a Transliterator object on success, or NULL on failure

static array|false listIDs()

(PHP >= 5.4.0, PECL intl >= 2.0.0)
Get transliterator IDs

Return Value

array|false

An array of registered transliterator IDs on success, or FALSE on failure.

string|false transliterate(string $string, int $start = 0, int $end = -1)

(PHP >= 5.4.0, PECL intl >= 2.0.0)
Transliterate a string

Parameters

string $string

The string to be transformed.

int $start

[optional]

The start index (in UTF-16 code units) from which the string will start to be transformed, inclusive. Indexing starts at 0. The text before will be left as is.

int $end

[optional]

The end index (in UTF-16 code units) until which the string will be transformed, exclusive. Indexing starts at 0. The text after will be left as is.

Return Value

string|false

The transfomed string on success, or FALSE on failure.

int|false getErrorCode()

(PHP >= 5.4.0, PECL intl >= 2.0.0)
Get last error code

Return Value

int|false

The error code on success, or FALSE if none exists, or on failure.

string|false getErrorMessage()

(PHP >= 5.4.0, PECL intl >= 2.0.0)
Get last error message

Return Value

string|false

The error code on success, or FALSE if none exists, or on failure.