News Feed
Sections
News Archive


Community Events






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


feed this:

PHP in Action Blog:
I want enums in PHP
0 comments :: posted Monday May 12, 2008 @ 08:41:16
voice your opinion now!
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) .

tagged with: enumeraction enum phpinaction multiple value constant



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

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