When I run a function that contains double quotes through this function, then quoting its quote.
I want to remove them altogether (even a single quote) How can I change the function to do this?
It appears that your original string contained HTML characters for " (
& amp; quot; ), so when you Clear it, you can simply delete
& amp; and
; Exclude the remaining string
quot .
--- Edit ---
Perhaps the easiest way to remove non-alpha numerical characters HTML characters have to be decoded, then it will run through regular expression, in this situation, the need to re-encode T, you do not need to do it again, but it is worth remembering that you Was the HTML data and now you raw unencoded data.
Example:
function string_sanitize ($ s) {$ result = preg_replace ("/ [^ a-zA-Z0-9] + /", "", Html_entity_decode ($ s, ENT_QUOTES)); Return result; }
Note that the
ENT_QUOTES function is "convert to both double and single quotes."
Comments
Post a Comment