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

Copying, Cloning, and Serializing Locale Objects

Use object cloning to duplicate a locale object exactly and efficiently. Most locale-aware methods also accept string representations of locales, such as the result of $locale->toString().

Example 549. clone

= new Zend_Locale('ar');

// Save the $locale object as a serialization
$serializedLocale $locale->serialize();
// re-create the original object
$localeObject unserialize($serializedLocale);

// Obtain a string identification of the locale
$stringLocale $locale->toString();

// Make a cloned copy of the $local object
$copiedLocale = clone $locale;

"copied: "$copiedLocale->toString();

// PHP automatically calls toString() via __toString()
print "copied: "$copiedLocale;

Zend Framework