getParamArray.php
Table of Contents
Functions
- getParamArray() : array<string|int, mixed>|null
- Retrieves a parameter from the HTTP request and ensures it is an array.
Functions
getParamArray()
Retrieves a parameter from the HTTP request and ensures it is an array.
getParamArray(ServerRequestInterface|null $request, string $name[, array<string|int, mixed> $args = [] ][, array<string|int, mixed>|null $defaultValue = null ][, string $strategy = HttpParamStrategy::BOTH ][, bool $throwable = false ]) : array<string|int, mixed>|null
This helper calls getParam() and checks the returned value:
- If the value is an array, it is returned.
- Otherwise, the
$defaultValueis returned. - If
$throwableis true, aNotFoundExceptionmay be thrown bygetParam().
Parameters
- $request : ServerRequestInterface|null
-
The PSR-7 server request instance.
- $name : string
-
The parameter name or dot-notated path.
- $args : array<string|int, mixed> = []
-
Optional default values passed to
getParam(). - $defaultValue : array<string|int, mixed>|null = null
-
Value returned if the parameter is missing or not an array. Default is null.
- $strategy : string = HttpParamStrategy::BOTH
-
Which source to search:
HttpParamStrategy::BOTH|QUERY|BODY. Default is BOTH. - $throwable : bool = false
-
Whether to throw a
NotFoundExceptionif parameter is missing. Default false.
Tags
Return values
array<string|int, mixed>|null —The parameter value if it is an array, otherwise $defaultValue or null.