|
@@ -0,0 +1,38 @@
|
|
|
+<?php
|
|
|
+echo 'hello world';
|
|
|
+$var1 =5;
|
|
|
+$var2 = 1;
|
|
|
+echo $var2;
|
|
|
+
|
|
|
+$var2 = 2;
|
|
|
+echo $var2;
|
|
|
+
|
|
|
+unset($var2);
|
|
|
+
|
|
|
+$a = 'b';
|
|
|
+$b = 'bb';
|
|
|
+echo $a;
|
|
|
+echo $$a;
|
|
|
+
|
|
|
+//使用函数定义常量:define
|
|
|
+define('PI',3.14);
|
|
|
+const PII = 3;
|
|
|
+
|
|
|
+define('-_-',smile);
|
|
|
+const -_- = smile;
|
|
|
+
|
|
|
+echo -_-;
|
|
|
+echo constant('-_-');
|
|
|
+
|
|
|
+//系统常量
|
|
|
+echo phpversion,php_int_size,php_int_max;
|
|
|
+
|
|
|
+//数据类型
|
|
|
+$a = 'abc1.1.1';
|
|
|
+$b = '1.1.1abc';
|
|
|
+echo $a + $b;//自动转化
|
|
|
+echo '<br/>',(float)$a,(float)$b; //强制转换 //以字母开头的字符串,永远为0;以数字开头的字符串,碰到字符串小数点为止;
|
|
|
+
|
|
|
+var_dump(is_int($a)); //false
|
|
|
+var_dump(is_string($a));//true
|
|
|
+echo gettype($a);//获取类型,得到的是该类型的对应的字符串
|