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()          这个函数返回的是当前函数的参数数量 返回的是数字


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

查看所有标签

猜你喜欢:

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

Distributed Algorithms: An Intuitive Approach

Distributed Algorithms: An Intuitive Approach

Wan Fokkink / MIT Press / 2018-2-2 / USD 48.00

The new edition of a guide to distributed algorithms that emphasizes examples and exercises rather than the intricacies of mathematical models. This book offers students and researchers a guide to ......一起来看看 《Distributed Algorithms: An Intuitive Approach》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具