PHP setlocale() လုပ်ဆောင်ချက်
ဥပမာ
ဒေသန္တရကို US English သို့ သတ်မှတ်ပြီးနောက် မူရင်းသို့ တစ်ဖန်ပြန်သွားသည်-
<?php
echo setlocale(LC_ALL,"US");
echo "<br>";
echo setlocale(LC_ALL,NULL);
?>
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
setlocale() လုပ်ဆောင်ချက်သည် ဒေသဆိုင်ရာ အချက်အလက်များကို သတ်မှတ်ပေးသည်။
ဒေသဆိုင်ရာအချက်အလက်သည် ဘာသာစကား၊ ငွေကြေး၊ အချိန်နှင့် ပထဝီဝင်နယ်မြေတစ်ခုအတွက် သီးခြားအချက်အလက်များဖြစ်သည်။
မှတ်ချက်- setlocale() လုပ်ဆောင်ချက်သည် လက်ရှိ script အတွက်သာ ဒေသန္တရကို ပြောင်းလဲပါသည်။
အကြံပြုချက်- ဒေသဆိုင်ရာ အချက်အလက်ကို 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 String အကိုးအကား