|
|
PHP base_convert() - Math Functions
|
Tutorials » Php »
|
Topic |
What is base_convert Function?
How to convert a base value to binary number?
|
|
Explanation |
|
The "base_convert()" function converts a number between arbitrary bases.
Syntax:
base_convert(number,frombase,tobase)
In the above syntax "number" is the orginal value, "frombase" is the original base of number, "tobase" the base to convert to.
Example:
<?php
$hex = 'A37334';
echo base_convert($hex,16,2);
?>
Result:
101000110111001100110100
In the above example the hexa decimal number "A37334" is converted to binary number as the "frombase" value is "16", "tobase" value is "2".
|
|
A Note |
Learn PHP programming language tutorial with simple and neat example. Hope you enjoy this free tutorial.
Do give us your valuable feedback and suggestions on this online tutorial. This is a Copyright Content.
|
|
|
|