php[tek] 2024 php[tek] 2024 Login
Embracing Enums
Speaker: Andy Snell
Embracing Enums

Level: Intermediate (some prior knowledge necessary)
Length: Standard (50 minutes)

Description:
In January 2020, I delivered a conference talk titled "Enums: The Missing Data Type", which ended on a sour note: PHP probably would not have a native type for handling enumerations any time soon. To my surprise and delight, PHP 8.1 would release with a new "Enum" type less than two years later. Now we can really explore enumerations: both the theory behind them and the current PHP implementation. We’ll cover how representing things like statuses with enums improves immutability, readability, and type safety; the different types of enums available to us; and address the most common questions: - Why can't PHP enums be extended like other classes? - Why can't backed PHP enums be cast to a string or int? - Why can't backed PHP enums be used as an array key?

JoindIn: https://joind.in/event/phptek-2024/embracing-enums

View Slides: https://wkdb.yt/enums

Thanks to our php[tek] 2025 sponsors!
PHP Architect
(Platinum)