How can I use PHP to add slashes to escape strings
- 1. use get_magic_quotes_gpc() to check if magic quotes feature was enabled.
- 2. use addslashes() function to quote string with slashes
$string = "GJkd'gk'"; if ( get_magic_quotes_gpc() ) $string = stripslashes($string ); $string = addslashes( $string );