September 2001
Intermediate to advanced
768 pages
32h 45m
English
string bin2hex(string string) Converts a string value from binary to hexadecimal.
Returns:
Hexadecimal value
Description:
bin2hex() converts a string of ASCII characters to their corresponding hexadecimal values. Note that any value passed to the function is converted to an ASCII string (if possible). The string can be converted back using pack(). See the examples.
Version:
PHP 3.0.9+, PHP 4+
See also:
Other functions that deal with the ASCII value of a character:
chr() ord() pack() printf() sprintf() unpack()
Examples:
<pre> <?php $string = "I'm a lumberjack and I'm ok...\n"; // Convert a string to its hex representation $hex_string = bin2hex ($string); echo $hex_string, "\n"; // Convert ... |
Read now
Unlock full access