I have a strange behaviour in my code.
function what_ever($array){
foreach ($array as $key => $value){
if($value === TRUE){
switch($key){
case 'xx':
....
}
}
}
}
After the if the $key is empty/gone what ever. Code like this works fine:
function what_ever($array){
foreach ($array as $key => $value){
if($value == TRUE){
switch($key){
case 'xx':
....
}
}
}
}
The second snippet is using only == instead of ===. But shouldn't it work anyway? If not why not?