PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<atanhbindec>
Last updated: Mon, 16 Jul 2012

base_convert

(PHP 3 >= 3.0.6, PHP 4, PHP 5)

base_convert -- 在任意进制之间转换数字

说明

string base_convert ( string number, int frombase, int tobase )

返回一字符串,包含 numbertobase 进制的表示。number 本身的进制由 frombase 指定。frombasetobase 都只能在 2 和 36 之间(包括 2 和 36)。高于十进制的数字用字母 a-z 表示,例如 a 表示 10,b 表示 11 以及 z 表示 35。

例子 1. base_convert()

<?php
$hexadecimal
= 'A37334';
echo
base_convert($hexadecimal, 16, 2);
?>

输出为:

101000110111001100110100




<atanhbindec>
 Last updated: Mon, 16 Jul 2012
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST