Home >Backend Development >PHP Tutorial >In PHP, we use a large number of numbers to identify types or states. What is the best solution?
Now we use an ftype field int type in the database table in MySQL to identify the type. At this time, there are about 20 types. Because of its age, the various numbers in the program look very laborious.
How do you deal with this kind of problem in the program?
Now our thinking is:
Restrict programmers to use numbers to add labels privately, add a class such as:
<code>class action { const EDIT = 0; const VIEW = 1; //... }</code>
You must use parameter action to use
2. Use the open source enumeration class on github to implement
such as: https://github.com/myclabs/ph...