Ask for the priority of include () and custom functions in PHP
Novice, from ASP to PHP do not blame!
Have a file
a.php
b.php
b.php Code
===========================
function test () {echo "Test";}
===========================
a.php
Using code (normal code)
===========================
Include ("b.php");
Test ();
===========================
Using code (Error code)
===========================
Test ();
Include ("b.php");
===========================
Harry
Whether the include itself belongs to the function
So there is no function inside the function to prevent the compilation problem include PHP ASP function
------Solution--------------------
Include is equivalent to putting the functions in the b.php file into the a.php
Calling a function in the b.php file before the include does not, of course, make an error
------Solution--------------------
This post was last edited by xuzuning on 2013-02-17 20:44:08
Declare first, then use
It's a universal principle.
------Solution--------------------
Two upstairs have explained the reason. Add one point:
Include, include_once, require, and require_once are language constructs rather than functions.
------Solution--------------------
For the understanding of the function in PHP there is no better way to read the above answer always feel their understanding specious
------Solution--------------------
Reference:
There is no better way to understand the function in PHP, after reading the above answer always feel that their understanding is specious
Look more, practice more, slowly deepen the memory.