In 2023, PHP 8.3 introduced many exciting features and enhancements. PHP 8.3 introduces a significant enhancement in the form of typed class constants. With this addition, developers can now declare types for class constants, ensuring type compatibility and reducing the likelihood of unintended deviations from the initial declaration. Prior to PHP 8.3, determining the syntactic validity of a JSON-encoded string involved using json_decode() and checking for errors.The new json_validate() function simplifies this process by validating the JSON syntax without the need to construct associative arrays or objects, thereby conserving memory.
PHP 8.3 introduces the getBytesFromString method in the \Random\Randomizer class, enabling the generation of random sequences based on a specified string of characters. This method proves useful for generating secure random bytes from a predefined set of characters.