How to get function parameters in php

王林
Release: 2023-03-03 15:56:02
Original
4628 people have browsed it

How to obtain function parameters in php: You can obtain them through the func_get_args() function. The function syntax is: [func_get_args(void)]. The array_get_args() function can obtain an array of function parameter lists.

How to get function parameters in php

func_get_args() Function: Get an array of function parameter lists.

(Recommended tutorial: php graphic tutorial)

Function syntax:

array func_get_args  ( void )
Copy after login

Code implementation:

<?php
function demo ()
{
  $args = func_get_args();
  echo "传入的参数分别为:";
  var_dump($args);
}
demo ( &#39;a&#39; , &#39;b&#39; , &#39;c&#39; );
Copy after login

(Video tutorial recommendation: php video tutorial)

Run result:

传入的参数分别为:
array (size=3)  
0 => string &#39;a&#39; (length=1)  
1 => string &#39;b&#39; (length=1)  
2 => string &#39;c&#39; (length=1)
Copy after login

The above is the detailed content of How to get function parameters in php. 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