The symbols in PHP

Source: Internet
Author: User

Double quotes are used to represent strings, except that the $ variable inside the double quotes is interpreted, for example:

12345 <?php    $n=123;    $s1="n=$n";//输出:n=123    $s2=‘n=$n‘;//输出:n=$n?>

Parentheses are required as function calls, or special syntactic constructs (if and for, etc.), which are similar to the C language and have nothing special, such as:

12345 <?php    $n=1;    if($n>=10) echo‘两位数‘;    else echo‘一位数‘;?>

The brackets are used in arrays, for example:

1234 <?php    $a=array(1,2,3);    echo$a[1];//输出2?>

Curly braces are used inside a string to represent the entire variable, for example:

123456 <?php    $a=123;    $aa=456;    echo"$aa";//输出456    echo"{$a}a";//输出123a?>

The symbols in PHP

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.