Home >Backend Development >PHP Tutorial >Detailed explanation of php reference string constant method
The result is (the output does not have any line breaks, for ease of understanding, line breaks are included in the results): my name is $name my name is yutuo my name is yutuo my name is yutuo my name is yutuo The three definition methods of single quotation marks, double quotation marks and the here document from the unix shell are introduced below. 1, single quoted string A single-quoted string refers to a string enclosed in single quotes. It only supports two escape characters, backslash () and single quote (‘), which are represented by (\) and (’) respectively. It should be noted that single-quoted strings do not support (n) line breaks, but single-quoted strings can be defined across lines. The following code: echo 'my name is yutuo. i am studing php.'; The result is (the output has newlines): my name is yutuo. i am studing php. 2, double quoted string A double-quoted string refers to a string enclosed in double quotes. It only supports multiple escape characters and can also be defined across lines. The book says there are curly brackets and square brackets, but when I tested it under PHP 5.3.1, there were none. The list of escape characters for its branches is as follows: " Double quotes n new line r Enter t tab character \ backslash $ dollar sign |