From c0f2a89236daaa58df68a343c20311880650331b Mon Sep 17 00:00:00 2001
From: kuangweijian <867034892@qq.com>
Date: Mon, 7 Mar 2022 19:33:32 +0800
Subject: [PATCH] =?UTF-8?q?php=E5=AD=A6=E4=B9=A0=E7=AC=AC=E4=B8=80?=
=?UTF-8?q?=E5=A4=A9:=E5=9F=BA=E6=9C=AC=E8=AF=AD=E6=B3=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
01基本语法/constants常量.php | 28 +++++++++++++++++++++++++++
01基本语法/global.php | 24 +++++++++++++++++++++++
01基本语法/static_variables.php | 16 +++++++++++++++
01基本语法/variable_variables.php | 10 ++++++++++
01基本语法/定界符.php | 17 ++++++++++++++++
01基本语法/运算符.php | 15 ++++++++++++++
01基本语法/预定义变量.php | 8 ++++++++
02流程控制/break_n.php | 26 +++++++++++++++++++++++++
02流程控制/demo.php | 3 +++
02流程控制/foreach.php | 17 ++++++++++++++++
02流程控制/include.php | 4 ++++
02流程控制/include_once.php | 5 +++++
02流程控制/inlude2.php | 3 +++
02流程控制/require.php | 4 ++++
03函数/01参数是class.php | 11 +++++++++++
03函数/03可变参数.php | 8 ++++++++
03函数/declare.php | 9 +++++++++
17 files changed, 208 insertions(+)
create mode 100644 01基本语法/constants常量.php
create mode 100644 01基本语法/global.php
create mode 100644 01基本语法/static_variables.php
create mode 100644 01基本语法/variable_variables.php
create mode 100644 01基本语法/定界符.php
create mode 100644 01基本语法/运算符.php
create mode 100644 01基本语法/预定义变量.php
create mode 100644 02流程控制/break_n.php
create mode 100644 02流程控制/demo.php
create mode 100644 02流程控制/foreach.php
create mode 100644 02流程控制/include.php
create mode 100644 02流程控制/include_once.php
create mode 100644 02流程控制/inlude2.php
create mode 100644 02流程控制/require.php
create mode 100644 03函数/01参数是class.php
create mode 100644 03函数/03可变参数.php
create mode 100644 03函数/declare.php
diff --git a/01基本语法/constants常量.php b/01基本语法/constants常量.php
new file mode 100644
index 0000000..02032b1
--- /dev/null
+++ b/01基本语法/constants常量.php
@@ -0,0 +1,28 @@
+'; //常量没有$号
+ echo b.'
';
+
+ //b=3; //b是常量,不能再修改
+ //echo b;
+
+ //获取常量
+ $b='b';
+ echo constant($b).'
';
+
+ //判断常量是否存在
+ const c=3;
+ $d=4;
+ var_dump(defined('c')); //常量c存在,返回true
+ echo '
';
+ var_dump(defined('d')); //d不是常量,返回false
+ echo '
';
+
+ //魔术常量
+ echo "当前文件路径".__FILE__;
+
+ /*
+ 感悟:php常量像C语言里的宏
+ */
+?>
\ No newline at end of file
diff --git a/01基本语法/global.php b/01基本语法/global.php
new file mode 100644
index 0000000..91665e3
--- /dev/null
+++ b/01基本语法/global.php
@@ -0,0 +1,24 @@
+ b:$b";
+ echo "
c:$c";
+ }
+
+ function func2()
+ {
+ echo "
a:".$GLOBALS['a']; // $GLOBALS['var'] 指的是函数外部变量本身,是一个变量.在程序的任意位置都能使用
+ echo "
b:".$GLOBALS['b'];
+ echo "
c:".$GLOBALS['c'];
+ }
+
+ func();
+ echo "
";
+ func2();
+?>
\ No newline at end of file
diff --git a/01基本语法/static_variables.php b/01基本语法/static_variables.php
new file mode 100644
index 0000000..8d86bdf
--- /dev/null
+++ b/01基本语法/static_variables.php
@@ -0,0 +1,16 @@
+"; //每当func()结束后,静态变量a的生命周期没有结束掉,不断的在原来的数值上+1,而b的生命周期结束了,每次调用func都是0
+ }
+
+ func();
+ func();
+ func();
+
+ echo $a; //但是静态变量作用域和局部变量是一样的,在作用域之外是不能使用的
+?>
+
diff --git a/01基本语法/variable_variables.php b/01基本语法/variable_variables.php
new file mode 100644
index 0000000..17e3deb
--- /dev/null
+++ b/01基本语法/variable_variables.php
@@ -0,0 +1,10 @@
+';
+
+ $$a='world'; //=>${$a}='world' =>($a='hallo')=> $hallo='world'
+ echo $$a.'
';
+
+ echo ${$a}.'
';
+?>
\ No newline at end of file
diff --git a/01基本语法/定界符.php b/01基本语法/定界符.php
new file mode 100644
index 0000000..395514d
--- /dev/null
+++ b/01基本语法/定界符.php
@@ -0,0 +1,17 @@
+
+
+