note 89455 modified in function.define by danbrown
| From: | danbrown@php.net | Date: | Mon, 09 Mar 2009 00:38:44 +0000 |
| Subject: | note 89455 modified in function.define by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-151640@lists.php.net to get a copy of this message | ||
Probably the most efficient way of creating a constant array is to put it in a function like this:
<?php
function my_const_arr()
{
return array
(
'key1' => 'val 1',
'key2' => 'va' 2'
);
}
?>
Then use at will like so...
<?php $my_const_arr = my_const_arr(); ?>
--was--
Probably the most efficient way of creating a constant array is to put it in a function like this:
function my_const_arr()
{
return array
(
'key1' => 'val 1',
'key2' => 'va' 2'
);
}
Then use at will like so...
$my_const_arr = my_const_arr();
http://php.net/manual/en/function.define.php