當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


PHP octdec()用法及代碼示例


octdec() 函數是 PHP 數學函數,用於將八進製數轉換為十進製數。

用法:

octdec(octal_string);
參數 描述 必需/可選
octal_string 要轉換的八進製字符串 Required

例子1

<?php
$nos=36;
echo "Your number is:".$nos;
echo "<br>"."By using 'octdec()' function your value is:".(octdec($nos));
?>

輸出:

Your number is:36
By using 'octdec()' function your value is:30

例子2

<?php
$nos=12;
echo "Your number is:".$nos;
echo "<br>"."By using 'octdec()' function your value is:".(octdec($nos));
?>

輸出:

Your number is:36
By using 'octdec()' function your value is:30

例子3

<?php
$nos=3063;
echo "Your number is:".$nos;
echo "<br>"."By using 'octdec()' function your value is:".(octdec($nos));
?>

輸出:

Your number is:3063
By using 'octdec()' function your value is:1587

示例 4

<?php
$nos=106;
echo "Your number is:".$nos;
echo "<br>"."By using 'octdec()' function your value is:".(octdec($nos));
?>

輸出:

Your number is:106
By using 'octdec()' function your value is:70ŚŚ






相關用法


注:本文由純淨天空篩選整理自 PHP octdec() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。