how to convert all characters to their html entity equivalent using PHP

Posted by Ashley Ward on Stack Overflow See other posts from Stack Overflow or by Ashley Ward
Published on 2010-06-09T10:55:54Z Indexed on 2010/06/09 11:02 UTC
Read the original article Hit count: 252

Filed under:
|
|
|
|

I want to convert this [email protected] 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....

© Stack Overflow or respective owner

Related posts about php

Related posts about string