How does php ensure the order in which two functions are called?

Source: Internet
Author: User
In php, how to ensure that another function must be called before a function is called. Of course, we may soon think of class constructors and member functions. Are there other methods besides this? Suppose you must call the Init function before calling Search. you can use the following method to group... SyntaxHighlighter. all ();

In php, how to ensure that another function must be called before a function is called. Of course, we may soon think of class constructors and member functions. Are there other methods besides this?

Assume that you must call the Init function before calling Search. the code can be organized as follows:

[Php] function Init (){
// Init implementation
// To do init
 
 
// Search implementation
// To do search
Function Search (){
}
}
Function Init (){
// Init implementation
// To do init


// Search implementation
// To do search
Function Search (){
}
}


In this way, you must call Init before calling the function Search. Otherwise, an error is reported!

For other details, see: http://cn2.php.net/manual/en/language.functions.php

 

From the pure soul

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.