पीएचपी बेस_कन्वर्ट () फंक्शन
उदाहरण
एक हेक्साडेसिमल संख्या को अष्टाधारी संख्या में बदलें:
<?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 |
टेक्निकल डिटेल
प्रतिलाभ की मात्रा: | निर्दिष्ट आधार में परिवर्तित संख्या |
---|---|
वापसी का प्रकार: | डोरी |
पीएचपी संस्करण: | 4+ |
और ज्यादा उदाहरण
उदाहरण
एक अष्टक संख्या को दशमलव संख्या में बदलें:
<?php
$oct = "0031";
echo base_convert($oct,8,10);
?>
उदाहरण
एक अष्टक संख्या को एक हेक्साडेसिमल संख्या में बदलें:
<?php
$oct = "364";
echo base_convert($oct,8,16);
?>
❮ पीएचपी गणित संदर्भ