isValidJsonDecodeFlags.php
Table of Contents
Functions
- isValidJsonDecodeFlags() : bool
- Checks whether a given integer value is a valid combination of `json_decode()` option flags.
Functions
isValidJsonDecodeFlags()
Checks whether a given integer value is a valid combination of `json_decode()` option flags.
isValidJsonDecodeFlags(int $flags) : bool
The function compares the provided bitmask against the list of officially supported JSON_*
constants for json_decode()
in the current PHP version.
Note: PHP itself does not validate unknown flag bits in
json_decode()
— they are simply ignored. This helper ensures stricter validation.
Parameters
- $flags : int
-
One or more
JSON_*
constants combined with bitwise OR (|
).
Tags
Return values
bool —Returns true
if the given flags are a valid combination of json_decode()
options,
false
otherwise.