I'm testing a very simple code. Basically I'm doing a foreach in an array which has no keys, there is only one field that has a key "email".
This is the code:
Code: Select all
$data_array = array($name0,$company0,'email'=>$email0,$comment);
foreach($data_array as $field=>$data) {
if ($field == 'email') {
echo 'current field is email';
}
else {
echo 'current field is not email';
}
}
Code: Select all
if ($field == 'email') {
I solved the problem replacing the sentence for this one:
Code: Select all
if ($field === 'email') { Thanks a lot!