To define an associative array (hash) so that it is part of the namespace, instead of going into the global namespace, just declare it as const, istead of as a variable.
This is handy for lookup tables, config settings, etc.
// Example. Instead of writing:
$my_datatypes = [
"sterility" => [
"xlsx" => [
"Sample Type",
"Run Pass/Fail",
"Result"
],
"db" => [
"SampleType",
"RunPassFail",
"Result"
]
]
];
// ...declare the lookup table like this:
const MY_DATATYPES = [
"sterility" => [
"xlsx" => [
"Sample Type",
"Run Pass/Fail",
"Result"
],
"db" => [
"SampleType",
"RunPassFail",
"Result"
]
]
];
// ...and it will be declared within the current namespace.