PHP bindec( ) Function Last Updated : 22 Jun, 2023 Comments Improve Suggest changes Like Article Like Report While working with numbers, many times we need to convert the bases of number and one of the most frequent used conversion is binary to decimal conversion. PHP provides us with a built-in function bindec() for this purpose. The bindec() function in PHP is used to return the decimal equivalent of the binary number. It accepts a string argument which is the binary number we want to convert to decimal. The parameter must be a string otherwise different data types will produce unexpected results. Syntax: bindec(binary_string) Parameter: This function accepts a single parameter binary_string which represents the binary string you want to convert to decimal. Return Value: It returns the decimal value of the binary number binary_string. Examples: Input : bindec('110011') Output : 51 Input : bindec('000110011') Output : 51 Input : bindec('111') Output : 7 Below programs illustrate the bindec() function in PHP: When '110011' is passed as a parameter: html <?php echo bindec('110011'); ?> Output: 51 When '000110011' is passed as a parameter: html <?php echo bindec('000110011'); ?> Output: 51 When '111' is passed as a parameter: html <?php echo bindec('111'); ?> Output: 7 Reference: http://php.net/manual/en/function.bindec.php Comment More infoAdvertise with us Next Article PHP bindec( ) Function S Shubrodeep Banerjee Follow Improve Article Tags : Misc Web Technologies PHP PHP-math PHP-function +1 More Practice Tags : Misc Similar Reads 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 PHP fileinode() Function The fileinode() function is an inbuilt function in PHP that returns the inode of the file. Syntax: fileinode(string $filename): int|falseParameter: This function has only one parameter: filename: This parameter specifies the path for the particular file.Return Value: This function returns the inode 1 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 | dir() Function The dir() function in PHP is an inbuilt function which is used to return an instance of the Directory class. The dir() function is used to read a directory, which includes the following: The given directory is opened. The two properties handle and path of dir() are available. Both handle and path pr 2 min read 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 Like