Computer >> Computer tutorials >  >> Programming >> PHP

bindec() function in PHP


The bindec() function convert a binary number to decimal number.

Syntax

bindec(bin_str)

Parameters

  • bin_str − The binary string to convert

Return

The bindec() function returns decimal value of the specified string bin_str

Example

<?php
   echo bindec("1101");
?>

Output

The output displays that the bindec() function returns a decimal value:

13