وظيفة PHP setlocale ()
مثال
عيّن اللغة إلى اللغة الإنجليزية الأمريكية ثم عد إلى الإعداد الافتراضي مرة أخرى:
<?php
echo setlocale(LC_ALL,"US");
echo "<br>";
echo setlocale(LC_ALL,NULL);
?>
التعريف والاستخدام
تعيّن الدالة setlocale () معلومات الإعدادات المحلية.
المعلومات المحلية هي اللغة والنقدية والوقت والمعلومات الأخرى الخاصة بمنطقة جغرافية.
ملاحظة: تقوم الوظيفة setlocale () بتغيير الإعدادات المحلية فقط للبرنامج النصي الحالي.
نصيحة: يمكن ضبط معلومات اللغة على النظام الافتراضي باستخدام setlocale (LC_ALL ، NULL)
تلميح: للحصول على معلومات التنسيق الرقمية ، راجع الدالة localeconv () .
بناء الجملة
setlocale(constant,location)
قيمه المعامل
Parameter | Description |
---|---|
constant | Required. Specifies what locale information should be set. Available constants:
|
location | Required. Specifies what country/region to set the locale information to. Can be a string or an array. It is possible to pass multiple locations. If the location is NULL or the empty string "", the location names will be set from the values of environment variables with the same names as the constants above, or from "LANG". If the location is "0", the location setting is not affected, only the current setting is returned. If the location is an array, setlocale() will try each array element until it finds a valid language or region code. This is very useful if a region is known under different names on different systems. Note: To view all available language codes, go to our Language code reference. |
تفاصيل تقنية
قيمة الإرجاع: | إرجاع إعدادات اللغة الحالية ، أو FALSE عند الفشل. تعتمد القيمة المعادة على النظام الذي يعمل به PHP. |
---|---|
إصدار PHP: | 4+ |
التغيير: | PHP 5.3.0 - إذا تم تمرير سلسلة إلى المعلمة الثابتة بدلاً من أحد ثوابت LC_ ، فإن هذه الوظيفة تلقي إشعار E_DREPRECATED. |
❮ مرجع سلسلة PHP