PHP - handling apostrophes 8. December 2014 Lucas Comments (0) Here is the code you'll need to use to handle apostrophes, this just adds a backslash in front of the apostrophes$myvariable = str_replace("'","\'",$myvariable);