I am working on an existing piece of PHP code and try to understand it in order to debug an issue:
echo "Got here !!!\n";
var_dump($aHeaders);
if (isset($aHeaders['SALESCHANNEL'])) {
echo "aHeaders['SALESCHANNEL'] is set\n";
...
} elseif (isset($aHeaders['SALESUNIT'])) {
echo "aHeaders['SALESUNIT'] is set\n";
...
}
echo "Got there !!!\n";
and I get the following output:
Got here !!!
array(1) {
["EMAIL,FIRSTNAME,LASTNAME,PHONE,TITLE,DATEOFBIRTH,SALESUNIT,LANGUAGE,STATUS,IS_RESELLER,CUSTOMDATE,ADDRESS_1,ADDRESS_2,CITY,COUNTRY,ZIPCODE,"]=>
int(0) }
Got there !!!
I am no deep expert at PHP, but I believe I should see:
aHeaders['SALESUNIT'] is set
in the output. What is going wrong?
My PHP version is PHP 5.5.30 if it matters.
What you currently have is this:
$arr1 = array('EMAIL,FIRSTNAME,LASTNAME,PHONE,TITLE,DATEOFBIRTH,SALESUNIT,LANGUAGE,STATUS');
isset() would only work if you have the following:
$arr2 = array(
'EMAIL' => 'blah',
'FIRSTNAME' => 'blah',
'LASTNAME' => 'blah',
'PHONE' => 'blah',
'TITLE' => 'blah',
'DATEOFBIRTH' => 'blah',
'SALESUNIT' => 'blah',
'LANGUAGE' => 'blah',
'STATUS' => 'blah'
);