html - What does a \" do in php? -


this question has answer here:

i new php , html, , came across code has \" select name defined.

<select name=\"table\" ... 

my question is: doing?

thank you.

it's escape character. it's used ensure next character not treated code, part of string.

in case, means " part of string, , doesn't signify end of string within code.

for example, if want put inside of string...

he said "shut up"...

i'd write this...

$str = "he said \"shut up\"..."; 

the backslash can used special "sequences", insert special characters. example, if want insert newline string, i'd use \n escape sequence. or, if want full crlf, i'd use \r\n insert both carriage return (\r) , line feed (\n) together. there many escape sequences, of described here, in php documentation.


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -