Home > 类库下载 > PHP类库 > body text

How to pass an indefinite number of parameters into a php function?

高洛峰
Release: 2016-10-14 10:35:56
Original
2432 people have browsed it

How to pass an indefinite number of parameters into a php function?

I think there are two methods

Transfer values ​​in array

Get the value through func_get_args in the function


The simplest way is to pass in an array , the number of array values ​​can be unlimited. Another method is to use func_get_args to get the parameters. ) {

[0]=>

int(3)

[1]=>

string(3) "lee"


}

array(3) {

["sql"]=>

int(1)

["query"]=>

int(3)

["db"]=>

string(3) "lee"

}

array(0) {

}

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template