PHP Basic Statement

Source: Internet
Author: User

<?php PHP Embedded Statement?>

PHP comments are basically the same as HTML

Single-line Comment

/* Content * * Multi-line Comment

Output statement

Echo can sequentially output multiple strings separated by commas

Print can only output one string at a time, not multiple outputs at a time

Way, method

Print_r (array) print array

Var_dump () Output variable (type, length, etc.), commonly used to test a variable

Data type

Shaping int

Decimal and List precision floating-point number float double-precision floating-point numbers double and decmial digits after decimals can be defined

Character class char strings string

boolean bool can only output true or flase

Date Time datetime general PHP No

Object Type objects

Defining variables

$a variable A

Type conversions

$a = (type) $a cast to a type

Settype (variable, "type") sets the variable to a type

A method of variables

is set (variable) determines whether a variable is defined to be defined to return true without a defined return flase

unset (variable) Clear variable

Empty (variable) to determine if the variable is empty NULL returns true non-null return flase Note Assignment is 0 or an empty string is equivalent to null

& Fetch Address $a = 10; $b =& $a means to give the address of the A variable to B because they share an address, so one of the variables changes the other.

Variable variable $a = "Hello"; $hello = "Hello"; echo $ $a will output hello PHP dedicated other use will error

Definition of a string

\+ content backslash plus content transfer character \r,\n represents line break

$a = "Hello"; $b = ' Hello '

The escape character can be parsed in double quotation marks, and single quotation mark can not

Double quotation marks can parse the variable but when parsing the variable to put the variable into {}, otherwise there may be an error single quotation mark can not

PHP stitching strings with. (dot) stitching

PHP Basic Statement

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.