The second stage of PHP is to learn the basic syntax of php. The second stage is the basic syntax.

Source: Internet
Author: User

The second stage of PHP is to learn the basic syntax of php. The second stage is the basic syntax.

Basic php syntax

Output statement: A. echo output: multiple strings can be output, separated by commas

B. print Output: Only one string can be output. true or false is returned.

C. print_r (): the string and number can be simply printed out, while the Array is displayed in the form of an enclosed key and a list of values, and starts with Array.

D. var_dump: output type

Data Type: A. Weak Language

B. gettype ()

C. Judge type is _ type name ()

Variable definition: A. $ variable name = Value

B. Super global variable $ GLOBALS

C. Variable

D. Is the isset () variable defined?

E. unset () variable clearing

F. empty () determines whether the variable is null.

G. & get address

Type conversion: A. (Data Type) Variable

B. type conversion settype (variable name, type)

Operator expressionA: mathematical operators

B: String: the concatenation string uses.

C: comparison operator

D: logical operator and & or |

E: Others: @ logical control operator

? Ternary Operators

Statement: Branch statement: a. if... else

B. switch... case

Loop a.

B. while

FunctionDefinition

Elements B

C usage

D common random number generator rand ()

Take the current time ()

Date ()

Strtotime () converts an event to a UNIX Timestamp

Set the time zone date_default_timezone_set ('prc ')

Date. timezone = Europe/Paris changed to Etc/GMT-8

Format time date ()

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.