# HaruEncoder::getByteType

(PECL haru >= 0.0.1)

HaruEncoder::getByteType — Get the type of the byte in the text

### Description

HaruEncoder::getByteType ( string `$text` , int `$index` ) : int

Get the type of the byte in the text.

### Parameters

`text`

  The text.

`index`

  The position in the text.

### Return Values

Returns the type of the byte in the text on the specified position. The result is one of the following values:

- `HaruEncoder::BYTE_TYPE_SINGLE` - single byte character.
- `HaruEncoder::BYTE_TYPE_LEAD` - lead byte of a double-byte character.
- `HaruEncoder::BYTE_TYPE_TRAIL` - trailing byte of a double-byte character.
- `HaruEncoder::BYTE_TYPE_UNKNOWN` - invalid encoder or cannot detect the byte type.

### Errors/Exceptions

Throws a HaruException on error.