alemil alemil - 10 months ago 59
PHP Question

Cannot remove double quotes from string PHP

Have tried every solution here and still nothing.
This is var_dump string(19) ""Example"".
I just need to remove double quotes from name so "Example" should be Example
Tried with trim, preg_replace, substr.

I think that there is problem somewhere else but I dont have much experience with PHP so I am stuck.


Try trim($string, '"'); and take some time to learn about HTML entities.

What's happening is the double quotes are html entities, so as you've seen in var_dump the string is not "Movie Title" but &x#22;Movie Title&x#22;. There is no literal double quote in the string for the function to trim, so it fails. You need to trim the entity instead.