\UTF8

UTF-8 routines

Summary

Methods
Properties
Constants
__construct()
smartUtf8_encode()
smartUtf8_decode()
decodeUtf8()
html_uentity_decode()
utf8_ucfirst()
str_word_count_utf8()
mb_chr()
mb_explode()
mb_str_pad()
mb_strcasecmp()
mb_strrev()
mb_substr_replace()
utf8_ord()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

__construct()

__construct() : 

UTF8

Returns

smartUtf8_encode()

smartUtf8_encode( str) : 

Encode UTF-8 if not already UTF-8

Parameters

str

Returns

true if valid

decodeUtf8()

decodeUtf8(  utf8_string) : 

UTF-8 encoding - PROPERLY decode UTF-8 as PHP's utf8_decode can't hack it.

Freely borrowed from morris_hirsch at http://www.php.net/manual/en/function.utf8-decode.php bytes bits representation 1 7 0bbbbbbb 2 11 110bbbbb 10bbbbbb 3 16 1110bbbb 10bbbbbb 10bbbbbb 4 21 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb Each b represents a bit that can be used to store character data.

input CANNOT have single byte upper half extended ascii codes

Parameters

utf8_string

Returns

html_uentity_decode()

html_uentity_decode(  str) : 

Encode UTF-8 from unicode characters

Parameters

str

Returns

utf8_ucfirst()

utf8_ucfirst(  str) : 

A unicode aware replacement for ucfirst()

Parameters

str

Returns

str_word_count_utf8()

str_word_count_utf8(  str) : 

count UTF-8 words in a string

Parameters

str

Returns

mb_chr()

mb_chr(  dec) : 

Simulate chr() for multibytes strings

Parameters

dec

Returns

mb_explode()

mb_explode(  delimiter,   string,   limit = PHP_INT_MAX) : 

Simulate explode() for multibytes strings (as documented for PHP 7.0)

Parameters

delimiter
string
limit

Default is PHP_INT_MAX.

Returns

mb_str_pad()

mb_str_pad(  str,   pad_len,   pad_str =  ,   dir = STR_PAD_RIGHT,   encoding = NULL) : 

Simulate str_pad() for multibytes strings

Parameters

str
pad_len
pad_str

Default is ' '.

dir

Default is STR_PAD_RIGHT.

encoding

Default is NULL.

Returns

mb_strcasecmp()

mb_strcasecmp(  str1,   str2,   encoding = null) : 

Simulate strcasecmp() for multibytes strings

A simple multibyte-safe case-insensitive string comparison

Parameters

str1
str2
encoding

Default is NULL.

Returns

mb_strrev()

mb_strrev(  str) : 

Simulate strrev() for multibytes strings

Parameters

str

Returns

mb_substr_replace()

mb_substr_replace(  string,   replacement,   start,   length = null,   encoding = null) : 

Simulate substr_replace() for multibytes strings

Parameters

string
replacement
start
length

Default is NULL.

encoding

Default is NULL.

Returns

utf8_ord()

utf8_ord(  string) : 

Simulate ord() for UTF8 strings (not arbitrary multibytes strings)

Parameters

string

Returns