Function analysis of php common function processing

jacklove
Release: 2023-03-27 12:52:02
Original
1501 people have browsed it

This article will explain the function analysis of commonly used functions in PHP.

func_get_arg — Returns an item in the parameter list

func_get_args — Returns an array containing the function parameter list

func_num_args — Returns the number of parameters passed to the function

call_user_func — Call the first parameter as the callback function

call_user_func_array — Call the callback function and pass an array parameter as the parameter of the callback function

forward_static_call_array — Call a static method and pass the arguments as array

forward_static_call — Call a static method and pass the arguments as an array

======================== ==================

1.

func_get_arg、func_get_arg、func_num_args
class test{
  public function hello($a,$b,$c,$d){
   $num=func_num_args();
   echo "方法参数的个数为:".$num,"
";
   if(2<=$num){
    echo "方法的第三个参数为:".func_get_arg(2)."
";  
   }
   $num2=func_get_args();
   for($i=0;$i<$num;$i++){
       echo "第{$i}个参数为{$num2[$i]}"."
";   
   }
 }
}
$T=new test();
$T->hello(&#39;A&#39;,&#39;B&#39;,&#39;C&#39;,&#39;D&#39;);
//方法参数的个数为:4
//方法的第三个参数为:C
//第0个参数为A
//第1个参数为B
//第2个参数为C
//第3个参数为D
Copy after login

This article will explain the function analysis of commonly used functions in PHP. For more related content, please Follow php Chinese website.

Related recommendations:

PHP The simplest way to verify logged in users (basic form user verification)

In PHP development, how to determine whether the previous script has finished running during scheduled execution?

Detailed explanation of the difference and use of const and static in php

The above is the detailed content of Function analysis of php common function processing. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!