Evaluate the priority of include () and user-defined functions in php. how can this problem be solved?

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.