Which one is better to use default magic quotes or custom addlash / stripslash in PHP?

which one is better to use default magic quotes or custom addlash / stripslash in PHP? I want to use the best. please help me.

+3
source share
4 answers

neither.

magic quotes are the root of all evil! (in my eyes, even worse than premature xD optimization)

and why do you want to create a user-defined ( add| strip) slash function when you have your own php tags?

If you want to avoid the date for a database, use the functions that are specific to the database (for example mysqli_real_escape_string)

. ( ):

. . (. http://xkcd.com/163/)

+1

! PHP 5, PHP 6. , ! , . , ( Python).

+5

, . , - . - , . .

, HTML, htmlspecialchars() . SQL , , , mysql_real_escape_string(). XML, XML- PHP; .

. , .

+2

. script :

set_magic_quotes_runtime(0);

, PHP, PHP, , , .

, - , , PHP PHP, .

, .

+1

Source: https://habr.com/ru/post/1717253/


All Articles