What is the difference between a single quotation mark and a double quote for a string in PHP? Delimiter and double quote difference?
(1) What is the difference between single and double quotation marks?
1, can be used to escape the range, the single quotation mark can only escape the single quotation mark \ ', double quotation marks except single quotation mark cannot escape, other \ "\n\r\t can.
2, double quotation mark can parse PHP variable, single quotation mark cannot. That is, "my name is $name."
However, using a variable in a string, we instruct $ to indicate that the variable starts, but does not specify the end position of the variable, so an error occurs if it is not at the end.
Solution:
1, put at the end. There is nothing in the back, and nature is right.
2. Add a space after the variable. The default end of a space is encountered.
3. Use curly braces {}.
4. Use the connector "." Or ",", concatenate characters and variables.
(2) What is the difference between a delimiter and a double quote?
The delimiter is $str=<<. < p="">
1, the delimiter must be paired.
2, the right delimiter must be shelf, can not have any indentation.
3, the delimiter starts and Terminator cannot have anything behind.
Delimiter and double quote differences
1. The delimiter appears to be easy to read format.
2, the result of the delimiter output preserves the format.
(3) The following are some statements of variables and constants:
"; $name =" John Doe "; Echo $name; echo"
";//notice:undefined variable:name in ... Unset ($name); echo $name; echo.
";///constants can not be modified and deleted//constants after definition: (1) uppercase; (2) When multiple letters are underlined to connect define (" age ",); Echo age;//If the constant is the following-_-, then the direct echo is a syntax error, The way to change to another access constant is ECHO constant ("age");//notice:constant-already defined in ... Define ("Age",//parse error:syntax error, unexpected ') ', Expecting:: (T_paamayim_nekudotayim) in ... Unset (age); After//php execution, all variables and constants are released and collected by the system?>