Home > Article > Backend Development > How to convert php string to octal number
In PHP, you can convert decimal to octal through the decoct function. The syntax is such as "decoct(int $number);". The parameter "$number" represents the decimal number to be converted and the maximum value that can be converted. It is 4294967295 in decimal.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
php How to convert a string to an octal number?
Decimal to octal:
Function:decoct(int $number);
@param $number to be converted For decimal numbers, the maximum value that can be converted is 4294967295 in decimal, and the decoct() result is "37777777777".
@return Returns a string containing the octal representation of the given $number argument.
Function Description:
The maximum decimal value that the decoct() function can convert is 4294967295, and the result is "37777777777".
Example:
<?php echo decoct ( 10 ) . "\n" ; echo decoct ( 50 );
The above program statements will be output in sequence: 12, 62
Recommended learning: "PHP Video Tutorial 》
The above is the detailed content of How to convert php string to octal number. For more information, please follow other related articles on the PHP Chinese website!