$locale = getLocale(); print_r($locale);
Array ( [0] => en_US [1] => UTF-8 [2] => en_US.UTF-8 )
$locale = getLocale(); $lang = locale_get_primary_language($locale[0]); echo $lang;
enThe getLocale function is part of the Intl extension, which provides a set of functions for internationalization and localization. It is included with PHP by default, but may need to be enabled in the php.ini file.