- ini_set: documentation ( source)
- ini_get: documentation ( source)
<?php
$orig = PHP_VERSION_ID < 50600
? iconv_get_encoding('internal_encoding')
: ini_get('default_charset');
if (PHP_VERSION_ID < 50600) {
if ($encoding) {
$result = iconv_set_encoding('internal_encoding', $encoding);
} else {
$result = false;
}
} else {
ini_set('default_charset', $encoding);
$result = ini_get('default_charset');
}
if (!$result) {
echo 'Given encoding not supported on this OS!';
} else {
echo 'All good';
}