ABOL Hosting Support

ABOL Support Forums

PHP 8.3 improvements

Posts

PHP 8.3 improvements

#1

Peter Martin

PHP 8.3, released on November 23, 2023, introduces several improvements over PHP 8.2:

  1. Typed Class Constants: PHP 8.3 extends typing to class constants, including those in interfaces, traits, and enums, enhancing code clarity and security[1][2].

  2. New json_validate() Function: This function allows for efficient JSON syntax validation without the memory overhead of decoding[5].

  3. #[\Override] Attribute: This new attribute helps developers explicitly mark methods intended to override parent methods, reducing errors due to typos or changes in parent code[5].

  4. Performance Improvements: PHP 8.3 offers significant performance boosts, with some benchmarks showing up to a 12% speed increase over PHP 8.2[7].

  5. Stack Overflow Detection: New ini directives (zend.max_allowed_stack_size and zend.reserved_stack_size) help detect and handle stack overflows more gracefully[3].

  6. Enhanced Random Extension: New methods added to the \Random\Randomizer class, including getFloat(), nextFloat(), and getBytesFromString[2].

  7. Improved Error Handling: Introduction of enum-based error handling and more granular DateTime exceptions[4][2].

  8. New String Manipulation Functions: Addition of str_starts_with() and str_ends_with() functions for more efficient string operations[4].

These improvements in PHP 8.3 offer developers enhanced type safety, better performance, and new tools for common programming tasks, making it a worthwhile upgrade from PHP 8.2.

Citations:
[1] https://gtechgroup.it/en/php-8-3-the-new-features-and-changes-in-the-latest-version/
[2] https://php.watch/versions/8.3
[3] https://stitcher.io/blog/new-in-php-83
[4] https://www.nexcess.net/help/benefits-and-features-of-php-8-3/
[5] https://kinsta.com/blog/php-8-3/
[6] https://www.infoq.com/articles/whats-new-php-8-3/
[7] https://kinsta.com/blog/php-benchmarks/
[8] https://www.brainvire.com/blog/what-is-new-in-php-8-3/