Home > Backend Development > PHP Tutorial > How to correctly implement PHP function function expansion_PHP tutorial

How to correctly implement PHP function function expansion_PHP tutorial

WBOY
Release: 2016-07-15 13:32:57
Original
955 people have browsed it

In this article we will give you a detailed introduction to the code example of

PHP function extension:

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

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

Another PHP function function expansion method is:

<ol class="dp-xml"><li class="alt"><span><span class="tag"><</span><span> ?php  </span></span></li><li><span>function choose($name,$id,<br />$task,$</span><span class="attribute">instance</span><span>=</span><span class="attribute-value">0</span><span>){  </span></li><li class="alt"><span>global $db_link;  </span></li><li><span>.....  </span></li><li class="alt"><span>return $xx;   </span></li><li><span>}  </span></li><li class="alt"><span class="tag">?></span><span> </span></span></li></ol>
Copy after login

The use of this function is the same as usual, except when we do not pass in $instance, such as

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

It is handled by the default $instance=0. When we need $instance to expand the PHP function, the page we call can be written like this:

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


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446108.htmlTechArticleIn this article, we will introduce you to the code examples of PHP function expansion in detail: ?php functionchoose ($name,$id,$task){ global$db_link; ..... return$xx; } ? Calling...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template