PHP Basic Syntax

Source: Internet
Author: User

1. Two ways of marking and annotation

Single-line Comment

/* Multiline Comment */

2. Output statement

echo Output:echo can output multiple strings, separated by commas

  Print output: Print can output only one string, which returns TRUE or False

Print_r (): You can simply print the string and the number, and the array is displayed in the enclosed key and the list of merit, and in array

Var_dump (): Output Variable type information

3. Data type definition variables

  3.1 PHP is a weak type, the variable does not have a definite type

Definition: $ variable name = value; The $ variable name is whole and requires an overall operation

Data types in PHP are reflected in the values

$a = 10;

$b = "he{$a}llo";

$c = ' world ';

1. Double quotation mark inside can parse escape character, single quotation mark not

2. Double quotation mark inside can parse variable, single quotation mark not

 3.2 Third definition string, output full content, no escape characters, etc.

    $d = <<<aa

      Hello "AA", "BB", ' CC ',

      <input type= "text" value= "AA"/>

    aa;*/

 3.3 $e = $a. $c; Stitching strings with the.

3.4 Data type conversion, not strong, PHP is a weak type, you have become the past

$f = 10.05;

$f = (string) $f; Type conversions

$f = "Hello";

  3.5 The concept of variable variables

$AA = "CC";

$CC = "DD";

echo $ $AA; Variable variable

$DD = & $aa; & Take Address

$DD = "ee";

Echo $aa;

4, operator, expression

Relational operators: +-*/% + +--+ = =

Comparison operators:> < >= <= = = =!

Logical operators: and && or | | !

echo @ $c; The error suppressor @ does not suppress all

5. Statements

Branch:...

Cycle:...

PHP Basic Syntax

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.