Advertisement
tinwaninja

Decode Hex to Str

Dec 23rd, 2017
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. <?php
  2. function Hilangin($hex){
  3.     // hapus /x dari hex
  4.     $hex = str_replace('/x', '', $hex);
  5.     return ($hex);
  6. }
  7.  
  8. function Hexketext($x) {
  9.   $s='';
  10.   foreach(explode("\n",trim(chunk_split($x,2))) as $h) $s.=chr(hexdec($h));
  11.   return($s);
  12. }
  13.  
  14. function Textkehex($x) {
  15.   $s='';
  16.   foreach(str_split($x) as $c) $s.=sprintf("%02X",ord($c));
  17.   return($s);
  18. }
  19.  
  20. $hex    = "47/x4c/x4f/x42/x41/x4c/x53";
  21. print Hexketext(Hilangin($hex)).'<br>';
  22.  
  23. print Textkehex("GLOBALS")."\n";
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement