How do i encode all chars in a string.
Example :
A = %32 // Or something like that
B = %33
I want to do this without hardcoding every char. And i also want to be able to decode it again.
Is there a php function for this?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you really want to do this, you could do it with
preg_replace_callbackquite easily:You could reverse it with the inverse, using
chr:However, this is almost certainly unnecessary for whatever you’re doing…
See:
chrordpreg_replace_callback