PHP octdec( ) 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 an octal number to its decimal equivalent. There are many methods to convert an octal number to its decimal equivalent but they are a bit time-consuming. But PHP provides us with an in-built function which can be used to convert an octal number to its decimal equivalent. The octdec() function is a built in function in PHP and is used to calculate the decimal equivalent of an octal number. The octdec() function converts numbers that are too large to fit into the integer type, larger values are returned as a float in that case. Syntax: octdec(value) Parameters: This function accepts a single parameter $value . It is a string which represents the octal number whose decimal equivalent you want to find. Return Value:It returns the decimal representation of octal number passed as a string to the function. Examples: Input : octdec("46") Output : 38 Input : octdec("3098") Output : 24 Input : octdec("-105") Output : 69 Below program illustrate the working of octdec() in PHP: When a positive number is passed as a parameter: PHP <?php echo octdec("3098"); ?> Output: 24 When a negative number is passed as a parameter: PHP <?php echo octdec("-105"); ?> Output: 69 Important points to note: It converts an octal number to its decimal equivalent. It returns the values as float if the numbers are too large to be returned as integer type . Octal number system is not as popular as hexadecimal number system these days. Reference: http://php.net/manual/en/function.octdec.php Comment More infoAdvertise with us Next Article PHP octdec( ) Function S Shubrodeep Banerjee Follow Improve Article Tags : Misc Web Technologies PHP PHP-math PHP-function +1 More Practice Tags : Misc Similar Reads PHP hexdec( ) Function Hexadecimal is a positional numeral system with a base of 16. It has sixteen distinct symbols, where the first nine symbols are 0â9 which represent values zero to nine, and the rest 6 symbols are A, B, C, D, E, F which represent values from ten to fifteen respectively. Since hexadecimal digit repres 2 min read PHP | getdate() Function The getdate() function is an inbuilt function in PHP which is used to get date/time information of the current local date/time. Syntax: getdate($timestamp) Parameters: The getdate() function accepts one parameter and it is described below: $timestamp: It is an optional parameter which specifies an i 2 min read PHP | idate() Function The idate() function is an inbuilt function in PHP which is used to format a local time/date as an integer. The $format and $timestamp are sent as parameters to the idate() function and it returns an integer formatted according to the specified format using the given timestamp. Unlike the function d 2 min read PHP key() Function The key() function is an inbuilt function in PHP which is used to return the index of the element of a given array to which the internal pointer is currently pointing. The current element may be starting or next element which depends on the cursor position. By default cursor position is at zero inde 2 min read PHP intdiv() Function intdiv stands for integer division. This function returns the integer quotient of the division of the given dividend and divisor. This function internally removes the remainder from the dividend to make it evenly divisible by the divisor and returns the quotient after division. Syntax: int intdiv($d 2 min read PHP | header() Function The header() function is an inbuilt function in PHP which is used to send a raw HTTP header. The HTTP functions are those functions which manipulate information sent to the client or browser by the Web server, before any other output has been sent. The PHP header() function send a HTTP header to a c 3 min read PHP Math Functions PHP is a scripting language that comes with many built-in math functions and constants. These tools help you do basic math, solve more complex problems, and work with different math concepts. This guide gives an overview of PHP's math functions and constants, along with examples, practical uses, and 5 min read PHP | Functions A function in PHP is a self-contained block of code that performs a specific task. It can accept inputs (parameters), execute a set of statements, and optionally return a value. PHP functions allow code reusability by encapsulating a block of code to perform specific tasks.Functions can accept param 8 min read PHP min( ) Function The min() function of PHP is used to find the lowest value in an array, or the lowest value of several specified values. The min() function can take an array or several numbers as an argument and return the numerically minimum value among the passed parameters. The return type is not fixed, it can b 2 min read PHP end() Function The end() function is an inbuilt function in PHP and is used to find the last element of the given array. The end() function changes the internal pointer of an array to point to the last element and returns the value of the last element.Syntax:end($array)Parameters:This function accepts a single par 2 min read Like