note 98654 added to function.apc-define-constants

From: Date: Tue, 29 Jun 2010 13:13:20 +0000
Subject: note 98654 added to function.apc-define-constants
Groups: php.notes 
Request: Send a blank email to php-notes+get-170546@lists.php.net to get a copy of this message
It doesn't introduce much overhead if you make use of conditional function definitions: <?php if (function_exists('apc_load_constants')) { function define_array($key, $arr, $case_sensitive = true) { if (!apc_load_constants($key, $case_sensitive)) { apc_define_constants($key, $arr, $case_sensitive); } } } else { function define_array($key, $arr, $case_sensitive = true) { foreach ($arr as $name => $value) define($name, $value, $case_sensitive); } } //in your code you just write something like this: define_array('NUMBERS', Array('ONE' => 1, 'TWO' => 2, 'THREE' => 3)); ?> ---- Server IP: 69.147.83.197 Probable Submitter: 69.116.123.194 ---- Manual Page -- http://www.php.net/manual/en/function.apc-define-constants.php Edit -- https://master.php.net/note/edit/98654 Del: integrated -- https://master.php.net/note/delete/98654/integrated Del: useless -- https://master.php.net/note/delete/98654/useless Del: bad code -- https://master.php.net/note/delete/98654/bad+code Del: spam -- https://master.php.net/note/delete/98654/spam Del: non-english -- https://master.php.net/note/delete/98654/non-english Del: in docs -- https://master.php.net/note/delete/98654/in+docs Del: other reasons-- https://master.php.net/note/delete/98654 Reject -- https://master.php.net/note/reject/98654 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#170546) next »