About the use of PHP language!

Source: Internet
Author: User
Tags php language

<script type= "Text/javascript" >

</script>--js with PHP is a weakly typed language weakly typed language just does not display the performance definition variable when the system automatically gives default

So you can define variables when you define PHP variables.

1:

---------common statements in PHP:

$a = 10; Based on the value written, the system automatically becomes an int

$b = "Hello"; define a string;

$c = ' Hello '; ibid.

$d = "www{$a}www" inserts other characters into the character

-----"" and "difference"

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

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

$e =<<<xxx

XXX;

$f

----Output:

echo $a output statement

Var_dump ($a); the output statement used to test the code

More commonly used

-------Use of PHP

<?php

?>

<?

?>

----OUTPUT statement:

echo "Hello", "world"; can have more than one character at the same time there are more common

print "world"; not commonly used

Print_r (); Output array Information

Var_dump ();//Variables and types

------Common variable types in PHP in theory

int, float, double, bool, char, string

-----There are many similarities to the similarity of C # in PHP in the use of statements

---branch statements

1,if--else

2,if---else if----

3, if (nested)

Course Courseware Script:

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 66676869707172737475767778798081828384858687888990919293949596979899100101102103 <body><?php//注释/* 多行注释 *///输出语句//echo "hello","helloa";//print "world";//print_r(); //输出数组信息//var_dump();//变量和类型//变量定义//int float bool string//弱类型语言/*$a = 10;$b = "he{$a}llo"; $c = ‘world‘;$d = <<<AAhello "aa" , "bb" ,‘cc‘,<input type="text" value="aa" />AA;*///1.双引号里面可以解析转义字符,单引号不行//2.双引号里面可以解析变量,单引号不行//$e = $a.$c; //拼接字符串用的是.//$f = 10.05;//$f = (string)$f; //类型转换//$f = "hello"; //$aa = "cc";//$cc = "dd";//echo $$aa;  //可变变量//$dd = &$aa; //&取地址//$dd = "ee";//echo $aa;//运算符与表达式$a= 10;$b= 4;//echo $a/$b;//echo @$c; //错误抑制符,并不能抑制所有错误//echo $a==$b?"ok":"no"; //三目运算符 /*if($a==$b){    echo "ok";}else{    echo "no";}*/<br>语法//1.if...else...//2.if...else if...//3.if嵌套/*$a = 2;switch($a){    case 1:        echo "11111";        break;    case 2:        echo "222222";        break;    case 3:        echo "333333";        break;    default:        echo "444";        break;}*///1.for/*for($i=0;$i<10;$i++){    echo $i."<br>";}*///2.while//3.do...while //echo $e;//var_dump($f);?><script type="text/javascript"></script></body>

Reprint: http://www.cnblogs.com/koker/p/5542708.html

About the use of PHP language!

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.