I want to convert this hello@domain.com
to
hello@domain.com
I have tried:
url_encode($string)
this provides the same string I entered, returned with the @ symbol converted to %40
also tried:
htmlentities($string)
this provides the same string right back.
I am using a UTF8 charset. not sure if this makes a difference....
the above function works for 1 character but if you have a string you can do like this
Here it goes (assumes UTF-8, but it's trivial to change):
EDIT Recommended alternative using
unpack
:Much easier way to do this:
You can change the encoding if you are using anything different.