代码块
echo "Hello World";
直接给变量赋值,即可声明变量
$x=2;
大小写不敏感
数组和逻辑变量变量
$numarray=array(1,2,3);//数组 $t=true;//逻辑
运算符:+ – * / % += ++形同C语言
字符串连接:.
$hw="Hello"."World";
类定义
class user={
public $id;
public $name;
}
$wg=new user;
$wg->id=1;
$wg->name='hello';
函数定义
function funca($p1){
return $p1*2;
}
echo funca(3);
包含文件
include "inc.php"; require "req.php";//必须存在否则程序运行至此即停止