too long

so I have a string that goes like this:

$string = "This is a test string. It has characters like these: '";

Is there a php function that transforms these to their correspondent character, in my example the desired output would be:

print $string
// OUTPUT: This is a test string. It has characters like these: '

yes there is: htmlspecialchars_decode($string, ENT_QUOTES);

not sure about the specific ' char, as far as I know htmlspecialchars (with ENT_QUOTES flag) convert an apostrophe (') to ' (with a leading zero)

so the exact behavior on ' worth checking

EDIT: I made the test and it does work :)

You can use html_entity_decode()

It's like reverse htmlentities. If you use quotes in your input string you have to set the second parameter of html_entity_decode() to ENT_QUOTES

See it in action: http://sandbox.onlinephpfunctions.com/code/7f4649eb47a8e639c514787a100b63bbad4bc8c6