note 46143 deleted from function.func-get-args by peehaa

From: Date: Mon, 08 Apr 2019 06:13:00 +0000
Subject: note 46143 deleted from function.func-get-args by peehaa
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-210555@lists.php.net to get a copy of this message
Note Submitter: volte6 at drunkduck dot com ---- For those who have a use for a C style enum() function: <?php //******************************************* // void enum(); // enumerates constants for unique values guarenteed. function enum() { $i=0; $ARG_ARR = func_get_args(); if (is_array($ARG_ARR)) { foreach ($ARG_ARR as $CONSTANT) { define ($CONSTANT, ++$i); } } } // USAGE: enum(ERR_USER_EXISTS, ERR_OLD_POST); // etc. etc. //******************************************* ?> this can be used for error codes etc. I deliberately skipped the 0 (zero) define, which could be useful for error checking.

« previous php.notes (#210555) next »