note 65600 added to function.define

From: Date: Thu, 04 May 2006 12:46:47 +0000
Subject: note 65600 added to function.define
Groups: php.notes 
Request: Send a blank email to php-notes+get-110514@lists.php.net to get a copy of this message
<?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 ---- Server IP: 195.221.21.36 Probable Submitter: 86.205.154.95 ---- X-Spam-Status: No, hits=3.8 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER, UPPERCASE_25_50 autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.define.php Edit -- http://master.php.net/note/edit/65600 Del: integrated -- http://master.php.net/note/delete/65600/integrated Del: useless -- http://master.php.net/note/delete/65600/useless Del: bad code -- http://master.php.net/note/delete/65600/bad+code Del: spam -- http://master.php.net/note/delete/65600/spam Del: non-english -- http://master.php.net/note/delete/65600/non-english Del: in docs -- http://master.php.net/note/delete/65600/in+docs Del: other reasons-- http://master.php.net/note/delete/65600 Reject -- http://master.php.net/note/reject/65600 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#110514) next »