I want to use an array as a constant in PHP 5.6. The question is: how to check whether a key 'a' exists in the array and get the "Test2" return true as well?
My code now is like this:
const ARR = array(
'a' => 'first',
'b' => 'second'
);
$test1 = defined("ARR");
$test2 = defined("ARR['a']");
echo '<br>Test1: ';
var_dump($test1);
echo '<br>Test2: ';
var_dump($test2);
Result:
Test1: bool(true)
Test2: bool(false)