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 2026 sponsors!
PHP Architect
(Platinum)
PHPScore
(Gold)
Displace
(Gold)
Previous Sponsors
PHP Architect
PHP Architect
PHP Tek 2025, PHP Tek 2024, PHP Tek 2023
Prompt
Prompt
PHP Tek 2025
WPConcierge
WPConcierge
PHP Tek 2025
Roave
Roave
PHP Tek 2025
typesense
typesense
PHP Tek 2025
Geocod.io
Geocod.io
PHP Tek 2025
Vehikl
Vehikl
PHP Tek 2025, PHP Tek 2024
Laravel
Laravel
PHP Tek 2025
OSMI
OSMI
PHP Tek 2025, PHP Tek 2024, PHP Tek 2023
Clayton Kendall LLC
Clayton Kendall LLC
PHP Tek 2025
NativePHP
NativePHP
PHP Tek 2025
Compassionate Coding
Compassionate Coding
PHP Tek 2024
Private Packagist
Private Packagist
PHP Tek 2024
Zend
Zend
PHP Tek 2024
SensioLabs
SensioLabs
PHP Tek 2024
Vonage
Vonage
PHP Tek 2024
PubNub
PubNub
PHP Tek 2024
FusionAuth
FusionAuth
PHP Tek 2024
DevITjobs
DevITjobs
PHP Tek 2024
PhpStorm
PhpStorm
PHP Tek 2023
Infobip
Infobip
PHP Tek 2023
PhoneBurner
PhoneBurner
PHP Tek 2023
platform.sh
platform.sh
PHP Tek 2023