Hướng dẫn php hex to ascii
Is it possible to represent a sequence of hex characters (0-9A-F) with a sequence of 0-9a-zA-Z characters, so the the result sequence is smaller and can be decoded? For example:
asked Sep 20, 2011 at 16:30
3 You mean want to convert a string of hex digits into actual hex values?
answered Sep 20, 2011 at 16:33
Marc BMarc B 351k42 gold badges402 silver badges486 bronze badges You can trivially adapt the solution I presented
here using the function Edit: I had not read carefully enough :) Base 16 to base 62 is still very doable, as above. See it in action.
answered Sep 20, 2011 at 16:32
JonJon 418k78 gold badges722 silver badges793 bronze badges 1 The built-in php functions may help some landing here on a search:
answered Jun 1, 2020 at 23:33
Well, something similar, yes... parse the hex characters as a binary value, then convert to base64. That uses a little bit more than 0-9 a-z A-Z, but only a few more characters. Are you okay to use three other characters in addition to those 62? You can use (You could convert to base32 instead, but that wouldn't be as compact. Converting to bases which aren't powers of 2 is also feasible, but less appealing.) You'd also need some way of representing a final half-byte if your input sequence had an odd number of characters. You'll probably want to think about that before calling answered Sep 20, 2011 at 16:33
Jon SkeetJon Skeet 1.4m832 gold badges8978 silver badges9088 bronze badges 4 (PHP 4, PHP 5, PHP 7, PHP 8) hexdec — Hexadecimal to decimal Descriptionhexdec(string hexdec() will ignore any non-hexadecimal characters it encounters. As of PHP 7.4.0 supplying any invalid characters is deprecated. Parametershex_string The hexadecimal string to convert Return Values The decimal representation of Changelog
ExamplesExample #1 hexdec() example
Notes
See Also
hafees at msn dot com ¶ 12 years ago
programacion at mundosica dot com ¶ 10 years ago
flurinj at gmx dot net ¶ 12 years ago
brian at sagesport dot com ¶ 17 years ago
strip_chars($string, $char){ chuckySTAR ¶ 13 years ago
$dec; k10206 at naver dot com ¶ 14 years ago
Halit YEL - halityesil at globya dot net ¶ 12 years ago
$l){
Anonymous ¶ 17 years ago
Walter Wlodarski ¶ 14 years ago
sneskid at hotmail dot com ¶ 10 years ago
jose dot rob dot jr at gmail dot com ¶ 13 years ago
var_dump(hexbin('0xF8F800'));
Ultimater at gmail dot com ¶ 13 years ago
floatinghexdec("ff.ff");//255.99609375 helpmedalph at gmail dot com ¶ 6 years ago
chrism at four dot net ¶ 20 years ago
joquius at kakugo dot com ¶ 13 years ago
Anonymous ¶ 14 years ago
Manithu ¶ 15 years ago
cgarvis at gmail dot com ¶ 15 years ago
repley at freemail dot it ¶ 16 years ago
$pointer = 0; $pointer < $tot-1 ; $pointer++) {$hexstart = $hex_array[$pointer]; cory at lavacube dot com ¶ 16 years ago
$out; detrate at hotmail dot com ¶ 16 years ago
= "336699"; // color Gabriel Reguly ¶ 17 years ago
bishop ¶ 17 years ago
$asString ? "{$rgb[0]} {$rgb[1]} {$rgb[2]}" : $rgb);
zubfatal, root at it dot dk ¶ 17 years ago
$x = 0; $x < count($arrColors); $x++) { groobo ¶ 17 years ago
this1is4me at hotmail dot com ¶ 14 years ago
maddddidley at yahoo dot com ¶ 14 years ago
andreas.schmeiler ¶ 19 years ago
ayadav at infoprocorp dot com ¶ 16 years ago
andy at haveland dot com ¶ 11 years ago
strtohex("Knowledge is power")."\n";
Rosberg - rosberglinhares at gmail dot com ¶ 12 years ago
|