PHP Classes
elePHPant
Icontem

Div PHP Enum Class package blog

Recommend this page to a friend!

Latest Div PHP Enum Class package blog posts

  All package blogs All package blogs   Div PHP Enum Class Div PHP Enum Class   Blog Div PHP Enum Class package blog   Post article Post article  

1. How Would You Create Enums in PHP

Updated on: 2019-09-24

Posted on:

Enums, or enumerations, are types of values that can be assigned to a variable with a limited number of possible values.

Until today PHP does not have a native enum type. It offers a very basic implementation using SPL extension, but I prefer to believe that implementation is not ideal.

Alternatively, the Div PHP Enum package provides is a solution for this using classes. Thanks to some interesting features of PHP, you can make a taxonomy (hierarchy of terms) and give behavior to each term similar to what we can achieve using the Java language.

Read read article to learn how you can implement PHP enums using pure PHP code, thus without additional extensions.



Blog More ...   Post a comment Post a comment   See comments See comments (0)   Trackbacks (0)

 


  All package blogs All package blogs   Div PHP Enum Class Div PHP Enum Class   Blog Div PHP Enum Class package blog   Post article Post article