countCallableParam.php
Table of Contents
Functions
- countCallableParam() : int
- Returns the number of parameters of a given callable.
Functions
countCallableParam()
Returns the number of parameters of a given callable.
countCallableParam(callable|string|array<string|int, mixed>|object $callable[, bool $useCache = true ]) : int
This function accepts any PHP callable (Closure, invokable object, array [object/class, method], string function name, or static method string) and returns the number of parameters it declares.
Optionally, a cache can be used to avoid repeated reflection lookups for the same callable, which is useful when the callable is repeatedly inspected (e.g., in loops or recursive functions).
Parameters
- $callable : callable|string|array<string|int, mixed>|object
-
The callable to inspect.
- $useCache : bool = true
-
Whether to cache the computed parameter count. Default true.
Tags
Return values
int —The number of parameters declared by the callable.