Example 1 — Check That UTF-8 Is Supported
Search the list for one encoding name.
<?php
$encodings = mb_list_encodings();
var_dump(in_array("UTF-8", $encodings)); How It Works
- Get the list of encodings.
- Search it with
in_array(). - UTF-8 is always in the list.
- You get
true.

