PHP decoct( ) Function Last Updated : 22 Jun, 2023 Comments Improve Suggest changes Like Article Like Report In the earlier days of computing, octal numbers and the octal numbering system was very popular for counting inputs and outputs because as it works in counts of eight, inputs and outputs were in counts of eight, a byte at a time. Due to a wide usage of octal number system many times it happens that we require converting a decimal number to its decimal octal representation.There are many methods to convert a decimal number to its octal equivalent but they are a bit time-consuming.But PHP provides an inbuilt function which can be used to convert a decimal number to its octal equivalent. The decoct() function in PHP is used to return the octal equivalent of a decimal number. For 32-bit platforms, the largest number that can be converted is usually 4294967295 in decimal resulting in 37777777777 whereas in 64-bit platforms it is usually 9223372036854775807 in decimal resulting in 777777777777777777777. Syntax: string decoct(value) Parameters: This function accepts a single parameter value. It is the decimal number whose octal equivalent you want to calculate. Return Value: The decoct() function in PHP returns a string representing the octal equivalent of a decimal number passed to it as argument. Examples: Input : decoct("35") Output : 45 Input : decoct("67") Output : 103 Input : decoct("4294967295") Output : 37777777777 Below program illustrate the working of decoct() in PHP: PHP <?php echo decoct("35") . "\n"; echo decoct("67") . "\n"; echo decoct("4294967295") . "\n"; ?> Output: 43 103 37777777777 Important points to note : It converts a decimal number to its octal equivalent. Negative numbers are supported by this function. The octal number system is not as popular as hexadecimal number system these days. Reference: http://php.net/manual/en/function.decoct.php Comment More infoAdvertise with us Next Article PHP decoct( ) Function S Shubrodeep Banerjee Follow Improve Article Tags : Misc Web Technologies PHP PHP-math PHP-function +1 More Practice Tags : Misc Similar Reads PHP | exit( ) Function The exit() function in PHP is an inbuilt function which is used to output a message and terminate the current script. The exit() function only terminates the execution of the script. The shutdown functions and object destructors will always be executed even if exit() function is called. The message 2 min read PHP each() Function The each() function is an inbuilt function in PHP and is used to get the current element key-value pair of the given array to which the internal pointer is currently pointing. After returning the key and value of the current element the internal pointer is incremented by one in the array. Note: You 2 min read PHP | each() Function The each() function is an inbuilt function in PHP which basically returns an array with four elements, two elements (1 and Value) for the element value, and two elements (0 and Key) for the element key and moves the cursor forward. Syntax: each(array) Parameters: Array: It specifies the array which 2 min read PHP extract() Function The extract() Function is an inbuilt function in PHP. The extract() function does array to variable conversion. That is it converts array keys into variable names and array values into variable value. In other words, we can say that the extract() function imports variables from an array to the symbo 3 min read PHP | fgetc( ) Function The fgetc() function in PHP is an inbuilt function which is used to return a single character from an open file. It is used to get a character from a given file pointer. The file to be checked is used as a parameter to the fgetc() function and it returns a string containing a single character from t 2 min read PHP | fgets( ) Function The fgets() function in PHP is an inbuilt function which is used to return a line from an open file. It is used to return a line from a file pointer and it stops returning at a specified length, on end of file(EOF) or on a new line, whichever comes first. The file to be read and the number of bytes 2 min read PHP constant() Function The constant() function returns the value of a constant. It also works with class constants. Syntax: constant(constant) Parameter Values: constant: It is a required value that specifies the value of the constant. Return Value: It returns the value of a constant if the constant is defined else return 1 min read PHP define() Function The define() function is basically used by programmers to create constant. Constants in PHP are very similar to variables and the only difference between both are the values of constants can not be changed once it is set in a program. define() returns a Boolean value. It will return TRUE on success 2 min read PHP | fgetss( ) Function The fgetss() function in PHP is an inbuilt function which is used to return a line from an open file after removing HTML and PHP tags from the respective file. The fegtss() function stops returning at a specified length, on end of file(EOF) or on a new line, whichever comes first. The file to be re 2 min read PHP eval() Function PHP eval() function in PHP is an inbuilt function that evaluates a string as PHP code. Syntax: eval( $string ) Parameters: This function accepts a single parameter as shown in the above syntax and described below. $string: It must consist of a valid PHP code to be evaluated but should not contain op 2 min read Like