addslashes()示例是否为NULL字节?

What is NUL or NULL byte and how escaping works with NULL byte?

Can someone please give example?

single quote and double quote is very obvious but i am not clear about NULL byte.

Documentation from PHP.net.

addslashes() returns a string with backslashes before characters that need to be quoted in database queries etc. These characters are single quote ('), double quote ("), backslash () and NUL (the NULL byte).

I tried something like this:

$a = NULL;
$str = " NULL example $a ";
echo addslashes($str);

But i don't see any added slash in output.

NULL is included in a string like this:

$string = "This is a NULL character: \x00";

addslashes serves no useful function whatsoever and is a throwback to the bad old days. You should never ever ever ever absolutely NEVER use it for anything. Ever. If you need to escape input for storage in a database then use the proper escaping functions (PDO escape, mysql_real_escape_string, pg_escape_string, etc)