PHP base_convert() လုပ်ဆောင်ချက်
ဥပမာ
ဆဋ္ဌမကိန်းဂဏန်းကို အဋ္ဌမဂဏန်းအဖြစ် ပြောင်းပါ-
<?php
$hex = "E196";
echo base_convert($hex,16,8);
?>
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
base_convert() လုပ်ဆောင်ချက်သည် နံပါတ်တစ်ခုကို နံပါတ်တစ်ခုမှ နံပါတ်တစ်ခုသို့ ပြောင်းပေးသည်။
အထားအသို
base_convert(number,frombase,tobase);
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
number | Required. Specifies the number to convert |
frombase | Required. Specifies the original base of number. Has to be between 2 and 36, inclusive. Digits in numbers with a base higher than 10 will be represented with the letters a-z, with a meaning 10, b meaning 11 and z meaning 35 |
tobase | Required. Specifies the base to convert to. Has to be between 2 and 36, inclusive. Digits in numbers with a base higher than 10 will be represented with the letters a-z, with a meaning 10, b meaning 11 and z meaning 35 |
နည်းပညာဆိုင်ရာအသေးစိတ်
ပြန်ပို့တန်ဖိုး- | နံပါတ် သည် သတ်မှတ်ထားသော အခြေခံသို့ ပြောင်းသည် ။ |
---|---|
ပြန်ပို့အမျိုးအစား- | ကြိုးတစ်ချောင်း |
PHP ဗားရှင်း- | 4+ |
နောက်ထပ် ဥပမာများ
ဥပမာ
အဋ္ဌမဂဏန်းကို ဒဿမဂဏန်းအဖြစ် ပြောင်းပါ-
<?php
$oct = "0031";
echo base_convert($oct,8,10);
?>
ဥပမာ
အဋ္ဌမဂဏန်းကို ဆဋ္ဌမကိန်းဂဏန်းအဖြစ် ပြောင်းပါ-
<?php
$oct = "364";
echo base_convert($oct,8,16);
?>
❮ PHP သင်္ချာအကိုးအကား