Home >Backend Development >PHP Tutorial >Chuanzhi Podcast 2017 latest php video courseware recommendation
PHP ("Hypertext Preprocessor") is a general-purpose open source scripting language. The syntax absorbs the characteristics of C language, Java and Perl, which is easy to learn and widely used. It is mainly suitable for the field of Web development. PHP's unique syntax mixes C, Java, Perl, and PHP's own syntax. It can execute dynamic web pages faster. Compared with other programming languages, dynamic pages made with PHP embed programs into HTML (an application under the Standard Universal Markup Language) document for execution, and the execution efficiency is much higher than CGI that completely generates HTML tags. In "Chuanzhi Podcast 2017 Latest PHP Video Tutorial", we will teach you some basic knowledge of PHP.
Course playback address: http://www.php.cn/course/583.html
The teacher’s teaching style:
The teacher’s lectures are simple, clear, layer-by-layer analysis, interlocking, rigorous argumentation, rigorous structure, and use the logical power of thinking to attract students’ attention Strength, use reason to control the classroom teaching process. By listening to the teacher's lectures, students not only learn knowledge, but also receive thinking training, and are also influenced and infected by the teacher's rigorous academic attitude.
The more difficult points in this video are functions and variable functions , Anonymous function:
Variable variables refer to: treating the value of a variable as a variable name again to obtain the value of another variable.
For example:
$name = 'dqrcsc'; $myname = 'name';//$myname的值碰巧是另一个变量的变量名 echo $name;//输出$name的值 'dqrcsc' echo $myname;//输出$myname的值 'name' echo $$myname;//得到$myname的值 'name',通过$再将其解析为一个变量 $name,从而输出$name的值 'dqrcsc'
Anonymous function: that is, a function without a name
The definition of a function in php will be stored in the code area by the system during the compilation phase. You can use the function name in the code The code for this function is found in the area.
If there is no name, the memory address of the function needs to be saved through a variable.
$func = function(){ echo 'test'; }; var_dump($func);//object(Closure)#1 这是一个闭包
The address of the function is saved, how to call the anonymous function later?
Recall the calling form of the function: myfunc(); followed by a pair of parentheses after the function name indicates calling the function. The anonymous function calling form is the same as
$func(); //Indicates calling the anonymous function pointed to by the variable
Since adding () is considered to be a calling function, variable functions naturally appear here The concept of
Variable function: Like a variable variable, a variable stores the name of the function, obtains the value of the function, which is the name of the function, and then parses it as a function.
For example:
function test(){ echo 'test'; } $func = 'test'; $func();//$func取得该变量的值'test',后面加上(),被当做是函数test()去调用。
What if it is an anonymous function?
$func = function(){ $name = 'dqrcsc'; echo $name; }; $myfunc = 'func'; //$myfunc是一个可变变量,其存储的是$func的变量名 $$myfunc();//$$myfunc解析可变变量,获得$func的值,后面加上(),当做函数去调用,便输出'dqrcsc'了
It can be seen from the above that the principles of variable variables and variable functions are the same, but the parsing methods are different. If you want to parse a variable into a variable variable, add a $ Symbol is enough.
If you want to parse it into a variable function, just add () after it.
Then the question is, can functions and variables have the same name? The answer is yes.
function test(){ echo 'function'; } $test = 'var'; //与函数同名的变量 $myvar = 'test';//定义一个变量刚好存放的值为变量名和函数名 echo $$myvar; //将其解析为可变变量,输出'var' $myvar(); //将其解析为可变函数,输出'function'
Here is also recommended for everyone to download the information: http://www.php.cn/xiazai/learn/2107
The information is shared with everyone. Video tutorial courseware
The above is the detailed content of Chuanzhi Podcast 2017 latest php video courseware recommendation. For more information, please follow other related articles on the PHP Chinese website!