call_user_func函数详解

栏目: PHP · 发布时间: 8年前

内容简介:call_user_func函数详解

call_user_func函数类似于一种特别的调用函数的方法

function a($b,$c) {     echo $b;      echo $c;  }   call_user_func('a', "1","2");  call_user_func('a', "3","4");   //输出 1 2 3 4

注:a是公共方法

调用A类中的b方法并且传入参数$c

class A {      function b($c) {         echo $c;      }  }   call_user_func(array("A", "b"),"111");   //输出 111  ?>

相关函数

call_user_func_array     调用回调函数,并把一个数组参数作为回调函数的参数

func_get_args()          这个函数返回的是包含当前函数所有参数的一个数组

func_get_arg()           函数返回的是指定位置的参数的值

func_num_args()          这个函数返回的是当前函数的参数数量 返回的是数字


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

The Elements of Statistical Learning

The Elements of Statistical Learning

Trevor Hastie、Robert Tibshirani、Jerome Friedman / Springer / 2009-10-1 / GBP 62.99

During the past decade there has been an explosion in computation and information technology. With it have come vast amounts of data in a variety of fields such as medicine, biology, finance, and mark......一起来看看 《The Elements of Statistical Learning》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器