- $ Name = 'utuo ';
- // Single quotation mark string
- Echo 'My name is $ name ';
- // Single quotation mark string
- Echo "my name is $ name ";
- Echo "my name is {$ name }";
- // Here document string
- Echo <end
- My name is $ name
- My name is {$ name}
- End;
-
The result is (there is no line feed in the output, so it is easy to understand.): my name is $ namemy name is yutuomy name is yutuo The following describes the single quotes, double quotes, and here documents from unix shell. 1. single quotes string refers to a string enclosed by single quotes. It only supports two escape characters, backslash (\) and single quotation mark ('), which are expressed as (\) and (\') respectively. Note that single quotes strings do not support line breaks (\ n), but single quotes strings can be defined across rows. The following code: echo 'My name is yutuo. I am studing php. '; the result is (the output result contains a line break): my name is yutuo. I am studing php. 2. double quotation mark string refers to the string enclosed by double quotation marks. It only supports multiple escape characters and can be defined across rows. There are braces and brackets in the book, but I did not test them in php5.3.1. The escape character list of its sub-branch is as follows: \ "Double quotation marks \ n Newline \ r carriage return \ t tab \ backslash \ $ Dollar character \ 000 ~ 777 octal ascii code \ x00 ~ Ff hexadecimal ascii code3. here documents can easily put multiple lines of text into the program. In addition to different definition methods, the escape characters, cross-line definition, and double quotation marks are exactly the same. The method is defined as <identifier, ending with a single row identifier. Note that < <和标识符之间有一个空格,结尾标识符前不能有空格。< p> |