How to count the number of parameters passed in a PHP function?
With the help of func_num_args()
function, we can count the number of parameters passed into a PHP function.
Example of function func_num_args()
<?php
function count_param()
{
$count_args = func_num_args();
echo "Number of parameters: $count_args\n";
}
count_param(10, 20); // Output: Number of parameters: 2
?>
Learn more about the similar topics:
Tutorials |
---|
No Content Found. |
Exercises & Assignments |
---|
No Content Found. |
Interview Questions & Answers |
---|
No Content Found. |