$decimal_number = 10;
$binary_number = decbin($decimal_number);
echo $binary_number; // 輸出 1010
$decimal_number = 10;
$octal_number = decoct($decimal_number);
echo $octal_number; // 輸出 12
$decimal_number = 10;
$hexadecimal_number = dechex($decimal_number);
echo $hexadecimal_number; // 輸出 a
$binary_number = '1010';
$decimal_number = bindec($binary_number);
echo $decimal_number; // 輸出 10
$octal_number = '12';
$decimal_number = octdec($octal_number);
echo $decimal_number; // 輸出 10
$hexadecimal_number = 'a';
$decimal_number = hexdec($hexadecimal_number);
echo $decimal_number; // 輸出 10