PHP: My approach to saving Enum data values

Let me make a custom class to save them.

Photo by Croissant on Unsplash

After reading Salar’s way to “save” enum values, I decided to make my own way to save Enum values through a class called Enumerate.

The main task of an Enumerate instance is to allow to be set a valid state from a given list. If the state is not in the list, an Exception should be thrown because…

--

--

--

Graphic Designer graduate. Full Stack Web Developer. Retired Tech & Gaming Editor.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

C# Memory Management — Part 2 (Finalizer & Dispose)

Searching algorithms in data structure

Testing a web server : Part 1

A Beginner’s Introduction to the World of Code…

New vision of open-source development with T3RN

Exploit-Exercises Protostar Stack 5

The Ghost that Hunts New Developers

Scripting Library in Scala — Ammonite

Screenshot from 2017-09-27 12-57-34

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Italo Baeza Cabrera

Italo Baeza Cabrera

Graphic Designer graduate. Full Stack Web Developer. Retired Tech & Gaming Editor.

More from Medium

PHP: 10 tips to use for Mockery

PHP Examples of Polymorphism

How to Build a Robust web application with PHP and CodeIgniter

Why You Should Use Laravel Development For Skyrocket Your Business In 2022?