亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

PHP實(shí)現(xiàn)的各種進(jìn)制相互轉(zhuǎn)換功能小工具示例

 更新時(shí)間:2018年03月21日 09:39:24   作者:liuyuedetiankong  
這篇文章主要介紹了PHP實(shí)現(xiàn)的各種進(jìn)制相互轉(zhuǎn)換功能小工具,涉及php常見(jiàn)的二進(jìn)制、八進(jìn)制、十六進(jìn)制等相互轉(zhuǎn)換操作實(shí)現(xiàn)技巧,需要的朋友可以參考下

本文實(shí)例講述了PHP實(shí)現(xiàn)的各種進(jìn)制相互轉(zhuǎn)換功能小工具。分享給大家供大家參考,具體如下:

<html>
<head>
<title>進(jìn)制轉(zhuǎn)換器</title>
<?php
$n1=$n2="";
if($_POST){
  $n1=$_POST['n1'];
  $trans=$_POST['trans'];
  if($trans=='1'){
    $n2=decbin((int)$n1);
  }elseif($trans=='2'){
    $n2=decoct((int)$n1);
  }elseif($trans=='3'){
    $n2=dechex((int)$n1);
  }elseif($trans=='4'){
    $n2=bindec($n1);
  }elseif($trans=='5'){
    $n2=octdec($n1);
  }elseif($trans=='6'){
    $n2=hexdec($n1);
  }
}
?>
</head>
<body>
<form method="post" action="?act=do">
<input type="text" name="n1" value="<?php echo $n1;?>">
<select name="trans">
<option value="1">10to2</option>
<option value="2">10to8</option>
<option value="3">10to16</option>
<option value="4">2to10</option>
<option value="5">8to10</option>
<option value="6">16to10</option>
</select>
<input type="submit" value="轉(zhuǎn)換"><input type="text" name="n2" value="<?php echo $n2;?>">
</form>
</body>
</html>

運(yùn)行結(jié)果:

PS:這里再為大家推薦幾款計(jì)算與轉(zhuǎn)換工具供大家參考使用:

在線任意進(jìn)制轉(zhuǎn)換工具:
http://tools.jb51.net/transcoding/hexconvert

科學(xué)計(jì)算器在線使用_高級(jí)計(jì)算器在線計(jì)算:
http://tools.jb51.net/jisuanqi/jsqkexue

在線計(jì)算器_標(biāo)準(zhǔn)計(jì)算器:
http://tools.jb51.net/jisuanqi/jsq

更多關(guān)于PHP相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《PHP數(shù)據(jù)結(jié)構(gòu)與算法教程》、《php程序設(shè)計(jì)算法總結(jié)》、《php字符串(string)用法總結(jié)》、《PHP數(shù)組(Array)操作技巧大全》、《PHP常用遍歷算法與技巧總結(jié)》及《PHP數(shù)學(xué)運(yùn)算技巧總結(jié)

希望本文所述對(duì)大家PHP程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論