Get the App
SLTechnology News&Howtos  ›  Development  › 

How to calculate the number of parameters passed by function by PHP

Shulou Source: shulou.com Published: 2022-06-03 17:23:15 11月13日 Update

Editor to share with you PHP how to calculate the number of parameters passed by the function, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

1. You can count the number of parameters passed into the PHP function with the help of the func_num_args () function.

2. The func_num_args () function is used to return the number of parameters passed to the function, and its syntax is "func_num_args (): int".

The return value is: returns the number of parameters passed into the current user-defined function.

This function can be used with func_get_arg () and func_get_args () to allow user-defined functions to accept variable-length argument lists.

Example

Tags: Functions parameters number number users articles content not much most examples more knowledge industry grammar information information channels channels references learning help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Docker Redmi vpn Apple