News Feed
Jobs Feed
Sections

Recent Jobs

News Archive
PHP in Action Blog:
I want enums in PHP
May 12, 2008 @ 08:41:16

I want Enums in PHP

That's how this new post on the PHP in Action blog starts this morning. The one thing that he wants is enumeration support in PHP. He shows how it can currently come close with a "roles" system:

Useful examples I've encountered in web programming are states or stages in a process and user roles. Another kind of example is one I used in PHP In Action: an authorization system with three fixed roles or categories of user: regular, webmaster and administrator.

He sets up an example class that sets constants for the different access levels rather than just relying on strings to handle it (which, as he points out, could very easily be misspelled and not throw any kind of error) .

0 comments voice your opinion now!
enumeraction enum phpinaction multiple value constant



Similar Posts

DevShed: Implementing Destructors with Multiple Objects in PHP 5

Arnold Daniels' Blog: Wrong PHP prediction: you don’t need to patch PHP to run multiple versions

Pierre-Alain Joye's Blog: Release Announcements (GD, Hidef, and Zip)

Gentoo Blog: Reminder - You *Can* Run PHP4 And PHP5 On The Same Box At The Same Time

AnyExamples.com: PHP multiple photo thumbnail generator


Community Events











Don't see your event here?
Let us know!


zend code package framework conference ajax job zendframework releases example application PEAR database mysql cakephp PHP5 release security book developer

All content copyright, 2008 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework