<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> </head> <body> <?php //单行注释 /* 多行注释 */ //弱类型语言 //var a = 10; /*$a=10; $b = "hello"; var_dump($a); $a="world"; var_dump($a);*/ //$a = 10; //$a = (string)$a; //强制转换a的类型为字符串 //settype($a,"string"); //var_dump($a); /*$name = "张三"; $s = "hello {$name}aa"; $s1 = 'world'; */ //php里面拼接字符串用点,不用加号 //1.双引号里面可以解析转义字符 //2.双引号里面可以解析变量 //var_dump($s); /*echo $s1; $s2 = <<<A hello world <div id="aa" class="aa"></div> A; */ //可变变量 $a = "hello"; $hello = "张三"; echo $$a; //输出语法 //echo $a,"hello"; //可以同时输出多个字符串 //print $a; //每次只能输出一个 //print_r(); //专门打印数组的 //var_dump($b); //输出变量信息 ?> </body> <script type="text/javascript"> </script> </html>