Convert a string to number and back to string?
问题 I would like to know how I can convert a short ASCII string to a number (int, float, or numeric string). I saw a couple of posts here mentioned perfect hashes which seems like it might be what I need. However, I'm not quite understanding the math for this. How could you convert an ASCII string into a sequence of numbers and then back to a string? As a side note, breaking a string down into it's ASCII character numbers is easy enough. foreach(str_split($string) as $char) $number .= ord($char);