1.单引号和双引号区别
单引号串和双引号串在PHP中的处理是不相同的。双引号串中的内容可以被解释而且替换,而单引号串中的内容总被认为是普通字符 举例看下: $foo = 2;
echo “foo is $foo”; // 打印结果: foo is 2
echo ‘foo is $foo’; // 打印结果: foo is $foo
echo “foo is $foo\n”; // 打印结果: foo is 2 (同时换行)
echo ‘foo is $foo\n’; // 打印结果: foo is $foo\n
$foo = 2;
echo “foo is $foo”; // 打印结果: foo is 2
echo ‘foo is $foo’; // 打印结果: foo is $foo
echo “foo is $foo\n”; // 打印结果: foo is 2 (同时换行)
echo ‘foo is $foo\n’; // 打印结果: foo is $foo\n
2.变量作用域
1.局部变量local:它的作用域为函数定义范围内 2.全局变量global:它的作用域从定义处一直到文件结尾 global关键字 
 
3.静态作用域static  4.参数作用域  3.常量
设置常量时要用define()函数 
3.const定义常量和define()定义的区别 用法一:const用于类成员变量,一经定义不可修改,define用于全局常量,不可用于类成员变量的定义,const可在类中使用,define不能。 用法二:const定义的常量大小写敏感,而define可通过第三个参数(为TRUE表示大小写不敏感)来指定大小写是否敏感。在运行时定义一个常量。define(‘TXE’,100,TRUE);
用法三:const不能在条件语句中定义常量,而define函数可以。if($a>10){define(‘LE’,‘hello’);} 
->和=>区别

foreach as的遍历

|