I've read other questions here but none of the answers seems to fix this issue
my MySQL query brings back "Dino's"
$var = Dino& # 39; s; (no spaces);
I need to convert that ''' (no spaces) to "'" a single quote/apostrophe
I have tried the following and none seems to work.
$var = html_entity_decode( $var, ENT_COMPAT, 'UTF-8' );
$var = html_entity_decode( $var, ENT_COMPAT, 'ISO-8859-1' );
$var = html_entity_decode( $var );
Only when I add this line will the remainder of my script work.
$var = str_replace( ''', "'", $var );
Obviously I may need to to function for other html_entities so I need a solution other than that just above.
What am I overlooking, please?
Use at least ENT_QUOTES or similar instead of ENT_COMPAT.
As your goal is to convert the (single)-quotes from the html_entity back to character-representation. ENT_COMPAT won't convert single-quotes.
onlinephp.io Demonstration
From php.net: