Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

string base_convert(string value, int base, int new_base)


The base_convert function converts a number from one base to another. Some common
bases have their own functions.


<?
//convert hex CC to decimal
print(base_convert("CC", 16, 10));
?>


integer bindec(string binary_number)


The bindec function returns the integer value of a binary number written as a string. PHP
uses 32-bit signed integers. The binary numbers are little-endian, which means the least
significant bit is to the right. The first bit is the sign bit.


Figure 10-2. bindec.

integer ceil(double value)


The ceil function returns the ceiling of the argument, which is the smallest integer
greater than the argument.

Free download pdf