Online Snippets Library

How to find number of parameters passed into function

func_num_args() returns the number of arguments passed to the function.

Example

<?php
function bunny()
{
    $numargs = func_num_args();
    echo "Number of arguments: $numargs\n";
}
bunny(1, 2);   
?>

Out Put

Number of arguments: 2