PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Getting the language and region

Use getLanguage() to obtain a string containing the two character language code from the string locale identifier. Use getRegion() to obtain a string containing the two character region code from the string locale identifier.

Example 553. getLanguage and getRegion

<?php
$locale 
= new Zend_Locale();

// if locale is 'de_AT' then 'de' will be returned as language
print $locale->getLanguage();

// if locale is 'de_AT' then 'AT' will be returned as region
print $locale->getRegion();

Zend Framework