Advertisement
Narzew

Text to Int Encoder & Decode Helper

Nov 29th, 2012
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.65 KB | None | 0 0
  1. <?php
  2.  
  3. ///////////////////////////////////////////////////////
  4. //** Text to Int Encoder
  5. //** Text to Int Decode Helper
  6. //** Copyright by Narzew
  7. //** http://pokepark.tk
  8. //** 29.11.12
  9. ///////////////////////////////////////////////////////
  10.  
  11. ///////////////////////////////////////////////////////
  12. //**encode_ints
  13. //**Encodes string to int (one-way!)
  14. ///////////////////////////////////////////////////////
  15.  
  16. function encode_ints($text){
  17.  $letters = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
  18.  $ints = array('2','2','2','3','3','3','4','4','4','5','5','5','6','6','6','7','7','7','7','8','8','8','9','9','9','9');
  19.  return str_replace($letters, $ints, strtolower($text));
  20. }
  21.  
  22. ///////////////////////////////////////////////////////
  23. //**decode_ints
  24. //**Helps decoding ints making possibilities to each int
  25. ///////////////////////////////////////////////////////
  26.  
  27. function decode_ints($text){
  28.  $letters = array('(abc)','(abc)','(abc)','(def)','(def)','(def)','(ghi)','(ghi)','(ghi)','(jkl)','(jkl)','(jkl)','(mno)','(mno)','(mno)','(pqrs)','(pqrs)','(pqrs)','(pqrs)','(tuv)','(tuv)','(tuv)','(wxyz)','(wxyz)','(wxyz)','(wxyz)');
  29.  $ints = array('2','2','2','3','3','3','4','4','4','5','5','5','6','6','6','7','7','7','7','8','8','8','9','9','9','9');
  30.  return str_replace($ints,$letters, $text);
  31. }
  32.  
  33. ///////////////////////////////////////////////////////
  34. //**End of script
  35. ///////////////////////////////////////////////////////
  36.  
  37. ///////////////////////////////////////////////////////
  38. //**Copyright by Narzew
  39. //**http://pokepark.tk
  40. ///////////////////////////////////////////////////////
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement