PHP decoct()函数

PHP decoct()函数

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

语法

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

示例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

Camera课程

Python教程

Java教程

Web教程

数据库教程

图形图像教程

办公软件教程

Linux教程

计算机教程

大数据教程

开发工具教程