<?php //注释 /* 多行注释 */ //输出语句 //echo "hello","helloa"; //print "world"; //print_r(); //输出数组信息 //var_dump();//变量和类型 //变量定义 //int float bool string //弱类型语言 /*$a = 10; $b = "he{$a}llo"; $c = 'world'; $d = <<<AA hello "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"; }*/ //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>
|