note 83954 added to function.define
| From: | thscheer at web dot de | Date: | Fri, 20 Jun 2008 09:18:09 +0000 |
| Subject: | note 83954 added to function.define | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-140613@lists.php.net to get a copy of this message | ||
How to define an array as constant with define?
there is a simple way to define an array of values as constant...
just
define ("constant-name","value1,value2,value3,value4");
$t_array = preg_split('/,/', constant(constant-name), -1, PREG_SPLIT_NO_EMPTY);
var_dump($t_array);
array(4) { [0]=> string(6) "value1" [1]=> string(6) "value2" [2]=>
string(6) "value3" [3]=> string(6) "value4" }
Now you can iterate over the array defined as constant ...
----
Server IP: 203.142.84.218
Probable Submitter: 193.141.180.242
----
Manual Page -- http://www.php.net/manual/en/function.define.php
Edit -- https://master.php.net/note/edit/83954
Del: integrated -- https://master.php.net/note/delete/83954/integrated
Del: useless -- https://master.php.net/note/delete/83954/useless
Del: bad code -- https://master.php.net/note/delete/83954/bad+code
Del: spam -- https://master.php.net/note/delete/83954/spam
Del: non-english -- https://master.php.net/note/delete/83954/non-english
Del: in docs -- https://master.php.net/note/delete/83954/in+docs
Del: other reasons-- https://master.php.net/note/delete/83954
Reject -- https://master.php.net/note/reject/83954
Search -- https://master.php.net/manage/user-notes.php