Mr Chris Posted June 8, 2010 Share Posted June 8, 2010 Hello, I have a funtion which I run on a string to convert characters to their html eqivalent like so: $string = cleanInput("There's a big bad woolf"); //There& #38 ;s a big bad woolf Now this works great, but say I had the string $string = cleanInput("There's a big bad woolf here <a href=\"click.php\">here</a>"); That would convert the " to the html equavalent as well. How could I get around this please and say anywhere there is a <a href> link use the cleanInput function but anywhere else in the text string do? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/204203-ignore-a-href-link-within-a-function/ Share on other sites More sharing options...
premiso Posted June 8, 2010 Share Posted June 8, 2010 You can probably use htmlentities, if you want to remove the html completely, strip_tags. Unless I mis-read what you were asking. Quote Link to comment https://forums.phpfreaks.com/topic/204203-ignore-a-href-link-within-a-function/#findComment-1069551 Share on other sites More sharing options...
satya61229 Posted June 8, 2010 Share Posted June 8, 2010 You can use htmlentities with ENT_NOQUOTES parameter. Plz check here- http://php.net/manual/en/function.htmlentities.php Quote Link to comment https://forums.phpfreaks.com/topic/204203-ignore-a-href-link-within-a-function/#findComment-1069583 Share on other sites More sharing options...
Mr Chris Posted June 8, 2010 Author Share Posted June 8, 2010 Thanks, but ENT_NOQUOTES will leave both double and single quotes unconverted. I want double quotes unconverted which is great, but single quote I dont. Quote Link to comment https://forums.phpfreaks.com/topic/204203-ignore-a-href-link-within-a-function/#findComment-1069670 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.