The difference between a single quotation mark and a double quote delimiter

Source: Internet
Author: User
Tags escape quotes

Double quote resolution variable, single quote non-parsed variable, delimiter parse variable
Direct output single quotation marks in double quotes, double quotes directly in single quotation marks,
Single quote output single quotes need to be escaped, double quote output double quotes need to be escaped. (Escape character "\")
The double quote output variable name needs to be escaped (' \ ');

Cases:

Double quotes

$a = "123";
$b = "456";
$c = $a. $b;
echo "\ $c";d ie;
The output is the variable name $c

Echo $c;

The output result is $c=123456;


$a = ' jjjjjj ';
$b = "AAA $a";
Echo $b;

The output result is $b= "AAAJJJJJJ";


Delimiter: The delimiter text behaves just like a double-quoted string, with no double quotes

This means that you do not need to escape quotes in the delimiter text, but you can still use the escaped code listed above. Variables are expanded, but when you express complex variables in the delimiter text, you should be aware of the same as the string. (Note: There must be no space in front of the end of ABC)

Echo <<<ABC
111 $a
Abc


The difference between a single quotation mark and a double quote delimiter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.