New users who want to calculate the priority of include () and user-defined functions in php should switch from asp to php! File. phpb. phpb. php code ====================================== function & nbsp; test () {echo & nbsp; "test" ;}================== calculate the priority of include () and user-defined functions in php
Beginner, switch from asp to php!
File available
A. php
B. php
B. php code
======================================
Function test () {echo "test ";}
======================================
A. php
Use code (normal code)
======================================
Include ("B. php ");
Test ();
======================================
Use code (error code)
======================================
Test ();
Include ("B. php ");
======================================
Why?
Is the include itself a function?
So there is no function internal function to prevent compilation problems include php asp function
------ Solution --------------------
Include is equivalent to putting the function in the B. php file into a. php
Call the function in the B. php file before the include Operation. of course, an error occurs.
------ Solution --------------------
This post was last edited and declared by xuzuning at 20:44:08, and then used
This is a general principle
------ Solution --------------------
The two upstairs have explained the reason. Add:
Include, include_once, require, and require_once are both language structures rather than functions.
------ Solution --------------------
Is there any better way to understand the functions in php? after reading the above answers, I always feel like I understand them.
------ Solution --------------------
Reference:
Is there any better way to understand the functions in php? after reading the above answers, I always feel like I understand them.
Take a look and practice more to deepen your memory.