Jump to: navigation, search

Php base convert

From w3cyberlearnings

Contents

PHP function base_convert

This function converts numbers from one number base to another, and it returns a string representation of the number. Return NULL whenever any argument is NULL.

Syntax base_convert

  • Convert: Number to convert (string)
  • From: Base from
  • To: Base To
base_convert(Convert, From, To);

Example 1

<?php

echo base_convert(10,10,2);
echo "<br/>";
echo base_convert(10,2,10);
echo "<br/>";
echo base_convert('EE',18,8);
?>

Output

1010
2
412

Related Links


Navigation
Web
SQL
MISC
References