PHP Simple statement

Source: Internet
Author: User

(01) PHP tagged <?php?>

<? ?>

<%%>

<script lauguage= "PHP" ></scrit>

(02) Output statement
Echo can print multiple values without parentheses
Print has a return value that cannot be printed multiple values
Die () Output and exit the program
Exit () Output and exit the program
printf () Formatted output
sprintf () formatted return
Var_dump () Output all information and content testing
Print_f () Output all information and content testing


(03) Comments///* *

(04) data type int double float string char datetime (TIME) bool

(05) Define the variable $x = ""; Variable must start with $

(06) variable variable $a = "B";

$b = "word";

echo $ $a; The output is Word

(07) Determine if the variable has a value isset ()//null or 0 is false

(08) Clear variable unset ()

(09) Determine if the variable is empty ()

(10) Take the address character &

$a = 5;

$b =& $a;

$b = 10;

echo $a; Output is 10

(11) Output variable information details dump ()

Type name GetType ()

Array information Var_dump (array)

(12) Type conversion cast setType (variable, type)//cast variable to desired type

Type +var ()

(type) + variables such as (int) $a; Turn A into an integral type

Auto-conversion (rule) priority from high to low is floating point > Integer > Boolean, String

Boolean and string are converted to numeric types when the operation

String conversion to numeric type only extracts the beginning of the number, E (+/-) n represents the bottom of the 10 (+/-) n the number of square

(13) stitching strings.         such as echo "". $a. ""; The middle of the output is a sentence of variable a

(14) Error suppressor @//Mask off error
Error classification 1.notice 2.warning 3.error where error level is highest

(15) Conditional operator? : Structure: Judging condition? Output when correct: error when output

(16) escape character \ n line break \ r enter \ t Horizontal tabulation

(17) You can parse variables and escape characters in double quotes echo "hello{$a}\" HI "

Single quotation marks do not have the above function, the contents of single quotation marks are generally output as-is

(18) Delimiter definition character channeling $a =<<

(19) PHP Statement Branch Statement switch-case Statement IF-ELSE statement for Loop statement while Loop statement

PHP Simple 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.