Question: I will be loading article titles into strings, and the authors of these titles may or may not use both single and double quotes. To use this imported text in a variable, how can I prevent this from breaking the code as I will not be able to escape the characters myself?

Answer: 
Escaping the quotes only matters if you're putting it into a string literal (or a database, of course). Simply having the string does not require them to be escaped.
You could use htmlentities().

See full documentation [here](http://php.net/manual/en/function.htmlentities.php)