Convert integer values to other bases such as binary or base 32 and base 36 : base_convert « Math « PHP






Convert integer values to other bases such as binary or base 32 and base 36

 
<?php

echo base_convert('123', 10, 10) . "\n";
echo base_convert('42', 10, 2) . "\n";
echo base_convert('83', 10, 8) . "\n";
echo base_convert('291', 10, 16) . "\n";

echo base_convert('124356', 10, 32) . "\n";
echo base_convert('987654', 10, 36) . "\n";

echo base_convert('abcd', 16, 8) . "\n";
echo base_convert('abcd', 16, 2) . "\n";
?>
  
  








Related examples in the same category

1.string base_convert ( string num, int from_base, int to_base ) convert every base to every other base
2.function base_convert() converts any integer value from one base to another