note 65600 deleted from function.define by tularis

From: Date: Sun, 03 Jun 2007 09:39:16 +0000
Subject: note 65600 deleted from function.define by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-127147@lists.php.net to get a copy of this message
Note Submitter: xademax at gmail dot com ---- <?php class Define { var $Name; var $Func; function Define($Name, $Func) { $this->Name = $Name; $this->Func = &$Func; } } $DEFINES = array(); function set_define($Name, $Value, $Args) { global $DEFINES; foreach($DEFINES as $DEFINE) if($DEFINE->Name == $Name) return false; $DEFINES[] = new Define($Name, create_function($Args, 'return "' . $Value . '";')); } function get_define($Name, $Args = NULL) { global $DEFINES; foreach($DEFINES as $DEFINE) if($DEFINE->Name == $Name) { $Func = $DEFINE->Func; return eval('return $Func(' . implode(",", $Args) . ');'); } return false; } ?> <?php set_define("ERROR", 'There was an error : $error\n', '$error'); echo get_define("ERROR", array("pouet")); ?> This Exemple will show : There was an error : pouet

« previous php.notes (#127147) next »