How to use UTF-8 all the way through with MySQL and PHP?

Spread the love

Sometimes, we want to use UTF-8 all the way through with MySQL and PHP.

In this article, we’ll look at how to use UTF-8 all the way through with MySQL and PHP.

How to use UTF-8 all the way through with MySQL and PHP?

To use UTF-8 all the way through with MySQL and PHP, we can use the set_charset method.

For instance, we write

$mysqli->set_charset('utf8mb4'); 

to call $mysqli->set_charset with 'utf8mb4' to use UTF-8 for all database operations.

Conclusion

To use UTF-8 all the way through with MySQL and PHP, we can use the set_charset method.

Leave a Reply

Your email address will not be published. Required fields are marked *