PHP decbin() 函數是數學函數,用於將十進製數轉換為二進製數。它返回二進製數。
用法:
string decbin ( int $number );
參數 | 描述 | 必需/可選 |
---|---|---|
number | 指定要轉換的十進製值 | Required |
例子1
<?php
$decimal='14';
echo "Your Decimal number is:".$decimal."<br>";
echo "By using 'decbin()'function your Binary number is:".decbin($decimal);
?>
輸出:
Your Decimal number is:14 By using 'decbin()'function your Binary number is:1110
例子2
<?php
$decimal=3;
echo "Your Decimal number is:".$decimal."<br>";
echo "By using 'decbin()'function your Binary number is:".decbin($decimal);
?>
輸出:
Your Decimal number is:3 By using 'decbin()'function your Binary number is:11
例子3
<?php
$decimal=1;
echo "Your Decimal number is:".$decimal."<br>";
echo "By using 'decbin()'function your Binary number is:".decbin($decimal);
?>
輸出:
Your Decimal number is:1 By using 'decbin()'function your Binary number is:1
示例 4
<?php
$decimal=1569;
echo "Your Decimal number is:".$decimal."<br>";
echo "By using 'decbin()'function your Binary number is:".decbin($decimal);
?>
輸出:
Your Decimal number is:1569 By using 'decbin()'function your Binary number is:11000100001
例 5
<?php
$decimal=7;
echo "Your Decimal number is:".$decimal."<br>";
echo "By using 'decbin()'function your Binary number is:".decbin($decimal);
?>
輸出:
Your Decimal number is:7 By using 'decbin()'function your Binary number is:111
相關用法
- PHP decbin( )用法及代碼示例
- PHP decoct()用法及代碼示例
- PHP dechex()用法及代碼示例
- PHP decoct( )用法及代碼示例
- PHP dechex( )用法及代碼示例
- PHP deg2rad()用法及代碼示例
- PHP defined()用法及代碼示例
- PHP disk_total_space( )用法及代碼示例
- PHP dir()用法及代碼示例
- PHP date_default_timezone_set()用法及代碼示例
- PHP date_timezone_set()用法及代碼示例
- PHP date_get_last_errors()用法及代碼示例
- PHP date_offset_get()用法及代碼示例
- PHP date_create()用法及代碼示例
- PHP date_parse()用法及代碼示例
- PHP date_diff()用法及代碼示例
- PHP date_default_timezone_get()用法及代碼示例
- PHP date_isodate_set()用法及代碼示例
- PHP date_timestamp_set()用法及代碼示例
- PHP date_time_set()用法及代碼示例
注:本文由純淨天空篩選整理自 PHP decbin() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。