PHP has not enum, but there is a simple way to simulate it, using Class in php5.
I like to use this structure:
[code lang=”php” autolinks=”false” collapse=”false” firstline=”1″ gutter=”true” htmlscript=”false” light=”false” padlinenumbers=”false” smarttabs=”true” tabsize=”4″ toolbar=”false”]//
// example
//
class Outcode
{
const Ok = 0; // ok
const Old = 40; // very old db entry
const Bad = 50; // bad input format
const DBKo = 70; // db error / query null
const NoData = 80; // empty data
}[/code]
To use it:
[code lang=”php” autolinks=”false” collapse=”false” firstline=”1″ gutter=”true” htmlscript=”false” light=”false” padlinenumbers=”false” smarttabs=”true” tabsize=”4″ toolbar=”false”]$ret = Outcode::NoData;[/code]
enjoy.
- Swift – Simple full screen loader - 11 August 2022
- macOS – Disable microphone while typing - 11 April 2022
- iOS – Secure app sensitive information - 25 March 2022