How to implement PHPfunction function extension correctly _ PHP Tutorial

Source: Internet
Author: User
How to correctly implement PHPfunction function extension. In this article, we will introduce in detail the sample code for PHPfunction function extension :? Phpfunctionchoose ($ name, $ id, $ task) {global $ db_link; ...... return $ xx ;}? In this article, we will introduce you in detail.

PHP function extension code example:

  1. <? Php
  2. Function choose ($ name, $ id, $ task ){
  3. Global $ db_link;
  4. .....
  5. Return $ xx;
  6. }
  7. ?>

On the called page, it is often $ tmp = choose ($ name, $ id, $ task );

Another PHP function extension method is:

 
  1. < ?php
  2. function choose($name,$id,
    $task,$instance=0){
  3. global $db_link;
  4. .....
  5. return $xx;
  6. }
  7. ?>

The usage of this function is no different from that of the normal operation, but when we do not input $ instance, as shown in

$ Array = choose ($ name, $ id, $ task );

It is handled by default $ instance = 0. when we need $ instance for PHP function extension, the page we call can be written as follows:

$ Instance = "...";
$ Array = choose ($ name, $ id, $ task, $ instance)


Example code of function extension for using PHP functions :? Php functionchoose ($ name, $ id, $ task) {global $ db_link; ...... return $ xx ;}? In the tune...

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.