Example 1 — Set and Read the Internal Encoding
Change the internal encoding and read it back.
<?php
error_reporting(E_ALL & ~E_DEPRECATED);
iconv_set_encoding("internal_encoding", "ISO-8859-1");
echo iconv_get_encoding("internal_encoding"), PHP_EOL; How It Works
- Hide the deprecation notice. This keeps the output clean.
- Set the type and the name.
internal_encodingis the type. - Read it back with
iconv_get_encoding(). - See the new value. It is
ISO-8859-1.

