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: 
You can safely use any quotes in your variables - there's no limit in this regard.

You should, however, consider escaping the characters depending on the context you are going to use these variables at. For example, if you wish to display some data on a terminal - no escaping is required, while if showing the very same data inside a web page you will have to take care of that.

For displaying characters in web context, you should use [htmlentities()](http://php.net/htmlentities).

For using the data to craft a URL, you will find [urlencode()](http://php.net/manual/en/function.urlencode.php) useful. [http\_build\_query()](http://php.net/manual/en/function.http-build-query.php) might help as well.
You could use htmlentities().

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