When MAGIC_QUOTES_GPC = ON, using the addslashes () processed data in the database will be in the form of \ ', if the direct output at this time, you will find a more than the content of their expectations, so stripslashes (), it can put \ Remove (differs from str_replace ("\", "", $Str)).
When the MAGIC_QUOTES_GPC = off, the use of addslashes () processed data in the database will be ' form ' to save, there is no problem mentioned above, addslashes () play the role of inserting data without error, if the direct output at this time, the data is normal. No need to use stripslashes (). Addslashes () and stripslashes () are just the opposite, Direct Memory: addslashes () plus a \,stripslashes () go to a \ So when to use it?
Simply put: when MAGIC_QUOTES_GPC = ON, the system automatically handles issues such as single quotes, which doesn't matter with addslashes () and stripslashes (), but if you add data with addslashes (), Then the data must be displayed stripslashes () when MAGIC_QUOTES_GPC = off, the system does not handle such problems as single quotes, so the data must be inserted using addslashes (), the data is displayed without using Stripslashes (). Since there is analysis, what to do when the program? According to the above two cases, you can get: regardless of whether the MAGIC_QUOTES_GPC is on or off, we add data with addslashes (), when on, must use Stripslashes (), off is not used stripslashes (). How do I tell if it is on or off? Use GET_MAGIC_QUOTES_GPC ().
How to use Stripslashes and addslashes