note 27899 deleted from function.define by nlopess

From: Date: Thu, 09 Sep 2004 09:31:48 +0000
Subject: note 27899 deleted from function.define by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-76308@lists.php.net to get a copy of this message
Note Submitter: logan at logannet dot net ---- A simple enum function function enum() { $ArgC = func_num_args(); $ArgV = func_get_args(); for($Int = 0; $Int < $ArgC; $Int++) define($ArgV[$Int], $Int); } usage ... enum("None", "Bob", "Joe", "John"); so ... printf("%d %d %d %d", None, Bob, Joe, John); OR echo(None . " " . Bob . " " . Joe . " " . John); would output 0 1 2 3

« previous php.notes (#76308) next »