note 68515 deleted from function.define by bjori
| From: | bjori@php.net | Date: | Mon, 31 Jul 2006 08:16:54 +0000 |
| Subject: | note 68515 deleted from function.define by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-115370@lists.php.net to get a copy of this message | ||
Note Submitter:
----
I typically use serialize() to store arrays in constants.
<?php
$value = array('Jim','Bob','Rebecca','Cooter');
define('CONSTANT',serialize($value));
?>
And unserialize as needed.
<?php
$name = 'Bob';
if(in_array($name,unserialize(CONSTANT)))
{
# Do something
}
?>
Didn't see this mentioned here - simple approach, allows for constant arrays without a ton of
overhead.