当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


PHP decoct()用法及代码示例


Php decoct() 是重要的预定义数学函数。它用于将十进制数转换为八进制数。

用法:

string decoct ( int $number );
参数 描述 必需/可选
number 指定十进制值 Required

例子1

<?php
$decimal=15;
echo "Your Decimal number is:".$decimal."<br>";	
echo "By using 'decoct()'function, your Octal number is:".decoct($decimal);
?>

输出:

Your Decimal number is:15
By using 'decoct()'function, your Octal number is:17

例子2

<?php
$decimal=264;
echo "Your Decimal number is:".$decimal."<br>";	
echo "By using 'decoct()'function, your Octal number is:".decoct($decimal);
?>

输出:

Your Decimal number is:264
By using 'decoct()'function, your Octal number is:410

例子3

<?php
$decimal=30;
echo "Your Decimal number is:".$decimal."<br>";	
echo "By using 'decoct()'function, your Octal number is:".decoct($decimal);
?>

输出:

Your Decimal number is:30
By using 'decoct()'function, your Octal number is:36

示例 4

<?php
$decimal=70;
echo "Your Decimal number is:".$decimal."<br>";	
echo "By using 'decoct()'function, your Octal number is:".decoct($decimal);
?>

输出:

Your Decimal number is:70
By using 'decoct()'function, your Octal number is:106

例 5

<?php
$decimal=9999;
echo "Your Decimal number is:".$decimal."<br>";	
echo "By using 'decoct()'function, your Octal number is:".decoct($decimal);
?>

输出:

Your Decimal number is:9999
By using 'decoct()'function, your Octal number is:23417






相关用法


注:本文由纯净天空筛选整理自 PHP decoct() function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。