[EMAIL PROTECTED] wrote:
----- Original Message -----
From: "Waqas Habib"
Hi, I want to convert my (string, integer) data to binary format. And also
from binary data to integer format and to string also. Is there any data
type in php to hold binary data.
-Waqas Habib
between 0000-00-00 and 9999-99-99
------------------------------------
PHP is a loose type language. There is no BINARY type but rather BINARY is
an output format.
The php types are -
"boolean" (or, since PHP 4.2.0, "bool")
"integer" (or, since PHP 4.2.0, "int")
"float" (only possible since PHP 4.2.0, for older versions use the
deprecated variant "double")
"string"
"array"
"object"
"null" (since PHP 4.2.0)
To convert an integer value to a binary string then use decbin($value). This
is limited to 4 bytes and outputs a string.
To convert a binary string to a integer or floating point value use
bindec($binarystring).
Integers are 32 bit signed values in PHP.
PHP tries to convert types on the fly-
50 + "5" = 55
"50" . 5 = "505"
Thanks, Rob.
PS: no cross-posting here
---------------------------
Thanks Sir.
-Waqas Habib