输出:echo “hello world”;

定义常量(常量是全局的):

声明全局变量:在最外面声明,$a=1;
局部变量声明:在函数内部声明即可,如
function f1(){
$a=“你好”;
}
访问全局变量(能访问,更改,不能赋值给别的变量,不能直接运算):在函数内 ,global $a就能访问全局变量a

静态变量,函数执行后会保留下来:

删除变量,使用null:
$a=null;




输出:echo “hello world”;
定义常量(常量是全局的):
声明全局变量:在最外面声明,$a=1;
局部变量声明:在函数内部声明即可,如
function f1(){
$a=“你好”;
}
访问全局变量(能访问,更改,不能赋值给别的变量,不能直接运算):在函数内 ,global $a就能访问全局变量a
静态变量,函数执行后会保留下来:
删除变量,使用null:
$a=null;
本文标题:PHP输出,变量、常量的定义、访问与EOF
本文链接:https://www.haomeiwen.com/subject/ipqaictx.html
网友评论