Sign in Registration

Multibyte encodings, why do we need functions with the mb prefix in PHP


Often, when developing a web application or site, it is necessary to work with text resources. As a rule, the text has its own encoding, so it is important to use the appropriate functions. Today the most popular encoding is UTF8, it is a multibyte encoding.

What does multibyte encoding mean? This means that more than one byte can be allocated per character. Indeed, all characters are represented by bytes, to encode a character, a certain number of them will be required, and one may not be enough. This is especially true for unusual symbols and letters of any languages. Therefore, multibyte encodings are needed, of course PHP supports them.

There are functions that can independently determine the encoding of the text. You can also specify the desired encoding in them, if necessary. There are some functions that begin with the mb_ prefix . They are specially designed to work with text, mb means multibyte .

Let's see what are the main mb functions in PHP , below are only the most used ones:

Thus, it is best to use multibyte encodings for working with text. They allow correct operations with symbols.

Comments (0)
For commenting sign in or register.

Latest articles

Popular sections


Login to the web version
Android app:
Available on Google Play

Share this

Subscribe to