/* {{{ proto int bindec(string binary_number)
Returns the decimal equivalent of the binary number */
PHP_FUNCTION(bindec)
{
zval **arg;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &arg) == FAILURE) {
return;
}
convert_to_string_ex(arg);
if (_php_math_basetozval(*arg, 2, return_value) == FAILURE) {
RETURN_FALSE;
}
}
/* {{{ proto string decbin(int decimal_number)
Returns a string containing a binary representation of the number */
PHP_FUNCTION(decbin)
{
zval **arg;
char *result;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &arg) == FAILURE) {
return;
}
convert_to_long_ex(arg);
result = _php_math_longtobase(*arg, 2);
RETURN_STRING(result, 0);
}