How to pass variable parameters in php?

coldplay.xixi
Release: 2023-03-02 16:20:01
Original
3363 people have browsed it

php method to implement indefinite parameter passing: use the [func_num_args()] function to return the total number of parameters, the code is [ $args = func_get_args(); for($i=0;$i

How to pass variable parameters in php?

php method to implement indefinite parameter passing:

If you want to pass an indefinite number of parameters, you need to use func_get_args()Function to pass

func_num_args()Function to return the total number of parameters

";
        }
    }
    more_args('a','b','c','d','e','f');
?>
Copy after login

Execution results

How to pass variable parameters in php?

Related learning recommendations: PHP programming from entry to proficiency

The above is the detailed content of How to pass variable 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!