There is no built in PHP function that will take an entity such as &
and turn it into a double &. Just in case there is any confusion, the html entity for & is actually &
, not amp;
, so running any built in parser on your example will return the following:
and not
In order to get the double & version, you will need to use a regular expression.
Alternatively, if you in fact want the single & version, you have two possibilities.
& " ' < >
then you should use htmlspecialchars_decode. This would be sufficient for the example you give.I suspect that htmlspecialchars_decode will be faster than html_entity_decode so if it covers all the entities you wish to convert, you should use that.