How to encode single quotes

I want to know how I use htmlentities •' for 'in my code? Avoiding a single quote

hows apostrophework inIE

while($row = pg_fetch_array($result))
{
    if($row[3]=="")
    {

        $vmobj_Array[$i]=$row[0]."***".$row[1]."***".$row[2];
    }
    else
    {
        $vmobj_Array[$i]=$row[0].' ( '.$row[3].' )'."***".$row[1]."***".$row[2];

    }
    $i++;
}
+3
source share
1 answer

I think every question should have an answer, so I also post it here. Feel free to accept the answer that someone else has posted there right now.

htmlentities($str, ENT_QUOTES);or htmlspecialchars($str, ENT_QUOTES);should do the trick, where $ str should be replaced with the variable or string you want to delete (for example, $row[0]). If you just want to add it, all you have to do is add it:print "Here an apostrophe '";

+15
source

All Articles