I am trying to send user inputted text from server to server and the most logical way to do it seems to be to convert the string being sent to a safe format containing only safe characters. After some research I think that ASCII would be the best as it only contains &,#,numbers and ; which won't disrupt anything (will it?).
Is there a function to convert a string to ascii and another to convert back or do I have to do a series of str_replace() for all of the ascii characters?
Thanks to anyone who helps me out!
Convert a string to ascii
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Convert a string to ascii
Look at the string functions in the manual. There are a number of functions that might help:
http://www.php.net/manual/en/ref.strings.php
http://www.php.net/manual/en/ref.strings.php
(#10850)
Re: Convert a string to ascii
The only function which I think could be any use would be ord(), but that only provides a one way conversion and would require an extremely long loop to complete a whole string of text. Someone must have done this before, it seems like a pretty simple thing to do.