
The php string function dechex() converts an int into a string.
string dechex ( int $number )
In order to convert a string into its hex representation, you need the following function. There are no php functions designed to convert a string to hex.
function strhex($str)
{
$hex = '';
for ($i=0; $i < strlen($str); $i++)
{
$hex .= dechex(ord($str[$i]));
}
return $hex;
}
The $str parameter is a string.
It returns a hex value which is the hexadecimal representation of the string.
Example: We have the string "HeLLo WoRlD!"
The php string-to-hex function returns the value 48654c4c6f20576f526c4421. This is a series of hex value each of which represent the hex representation of "HeLLo WoRlD!"
Test it online using our String-to-Hex Tool
Review of my Blackberry Torch
August 23rd, 2010
Hi guys, I got the new iphone 4, I should be reviewing this iphone 4 and his case very soon!
July 6th, 2010
Here's my review on justhost web hosting service
May 14th, 2010
We will be talking about hosting server, dedicated server and shared server very soon!. We will be talking about C# and hosting servers
May 8th, 2010
The String Function Tools are designed to give you the most-used string functions
4. Url Encoding
8. Url Decoding
10. Html Decoding
If you have a question, noticed a problem, want to share an idea or simply want to comment this page, fill the box below and hit the "Submit" button
String to Lowercase Converter -
String to Uppercase Converter -
String to Hex Converter
Hex to String Converter -
Reverse String Online -
String Length Function -
Html Decode Online
Html Encode Online -
Url Decode Online -
Url Encode Online -
Hex to Binary Converter
Binary to Hex Converter -
Hex to Decimal Converter -
Convert a Decimal to Hex -
Binary to Decimal Converter
Decimal to Binary Converter -
Md5 Hash Online -
Sha1 Hash Online -
Md5 Reverse Lookup
Sha1 Reverse Lookup -
Ascii to Binary Converter -
Ascii to Decimal Converter
Convert Hex to Rgb -
Convert Rgb to Hex
